gpu: ion: Take handle reference in ion_vma_open
authorkfx <kfx@rock-chips.com>
Thu, 22 Dec 2011 12:16:41 +0000 (20:16 +0800)
committerkfx <kfx@rock-chips.com>
Thu, 22 Dec 2011 12:18:46 +0000 (20:18 +0800)
When ion_vma_open is called, a reference to the handle in
the vma must be taken. Otherwise, if forking occurs,
ion_vma_close will be called twice which will leave one of
the calls with an invalid reference.

drivers/gpu/ion/ion.c

index 16dedc19b118041c81ff886663e3ac3acc22d0fa..c5873151de48e9c06feecef61a8c2809ac841e86 100755 (executable)
@@ -798,6 +798,7 @@ static void ion_vma_open(struct vm_area_struct *vma)
                vma->vm_private_data = NULL;
                return;
        }
+       ion_handle_get(handle);
        pr_debug("%s: %d client_cnt %d handle_cnt %d alloc_cnt %d\n",
                 __func__, __LINE__,
                 atomic_read(&client->ref.refcount),