gpu: ion: fix use-after-free in ion_heap_freelist_drain
authorMitchel Humpherys <mitchelh@codeaurora.org>
Sat, 14 Dec 2013 03:26:17 +0000 (19:26 -0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 14 Dec 2013 16:57:19 +0000 (08:57 -0800)
The `buffer' variable is being used after being freed. Fix this.

Signed-off-by: Mitchel Humpherys <mitchelh@codeaurora.org>
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/android/ion/ion_heap.c

index deaab7cd81165d2637c0a278e09ec8d088944518..0a5cea0c01e3f2e7ea0a90fe760c4200d9ced206 100644 (file)
@@ -200,9 +200,9 @@ size_t ion_heap_freelist_drain(struct ion_heap *heap, size_t size)
                if (total_drained >= size)
                        break;
                list_del(&buffer->list);
-               ion_buffer_destroy(buffer);
                heap->free_list_size -= buffer->size;
                total_drained += buffer->size;
+               ion_buffer_destroy(buffer);
        }
        rt_mutex_unlock(&heap->lock);
 
This page took 0.024941 seconds and 5 git commands to generate.