[PATCH 014/115] gpu: ion: Loop on the handle count when destroying

From: John Stultz
Date: Fri Dec 13 2013 - 17:26:37 EST


From: Laura Abbott <lauraa@xxxxxxxxxxxxxx>

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 <lauraa@xxxxxxxxxxxxxx>
[jstultz: modified patch to apply to staging directory]
Signed-off-by: John Stultz <john.stultz@xxxxxxxxxx>
---
drivers/staging/android/ion/ion.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/android/ion/ion.c b/drivers/staging/android/ion/ion.c
index ddfe49a..dc7174d 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);

--
1.8.3.2

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/