gpu: ion: Loop on the handle count when destroying
authorLaura Abbott <lauraa@codeaurora.org>
Thu, 7 Jun 2012 23:41:30 +0000 (16:41 -0700)
committerArve Hjønnevåg <arve@android.com>
Mon, 1 Jul 2013 20:40:49 +0000 (13:40 -0700)
When destroying a handle, all kernel mappings to that handle
should be destroyed. Other handles may still have references
and valid mappings to the buffer underneath which should not
be destroyed. Loop on the handle reference count, not the buffer
reference count to get rid of all kernel mappings for the handle.

Change-Id: I7dc5d6a86513fc5fa4e21110ceab434714ea2493
Signed-off-by: Laura Abbott <lauraa@codeaurora.org>
drivers/gpu/ion/ion.c

index 36b723c201e980225e1360d7b16abdff29a9256c..505e28504c83282e90d0d810308902959df5933f 100644 (file)
@@ -232,7 +232,7 @@ static void ion_handle_destroy(struct kref *kref)
        mutex_lock(&client->lock);
 
        mutex_lock(&buffer->lock);
-       while (buffer->kmap_cnt)
+       while (handle->kmap_cnt)
                ion_handle_kmap_put(handle);
        mutex_unlock(&buffer->lock);