From: Laura Abbott Date: Fri, 13 Dec 2013 22:23:48 +0000 (-0800) Subject: gpu: ion: Loop on the handle count when destroying X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=2900cd767180e9674947101fea96e318dc9b23eb;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git gpu: ion: Loop on the handle count when destroying 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. Signed-off-by: Laura Abbott [jstultz: modified patch to apply to staging directory] Signed-off-by: John Stultz Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/android/ion/ion.c b/drivers/staging/android/ion/ion.c index ddfe49a8eaa6..dc7174d96b55 100644 --- a/drivers/staging/android/ion/ion.c +++ b/drivers/staging/android/ion/ion.c @@ -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);