]> Pileus Git - ~andy/linux/commitdiff
gpu: ion: Loop on the handle count when destroying
authorLaura Abbott <lauraa@codeaurora.org>
Fri, 13 Dec 2013 22:23:48 +0000 (14:23 -0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 14 Dec 2013 16:55:37 +0000 (08:55 -0800)
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@codeaurora.org>
[jstultz: modified patch to apply to staging directory]
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/android/ion/ion.c

index ddfe49a8eaa63b125d5865aa8b4da3bd1dcd0856..dc7174d96b5543a3709e6b9f03bebd3ecf256d57 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);