gpu: ion: fix kfree/list_del order
authorJP Abgrall <jpa@google.com>
Mon, 15 Apr 2013 21:23:14 +0000 (14:23 -0700)
committerArve Hjønnevåg <arve@android.com>
Mon, 1 Jul 2013 21:16:23 +0000 (14:16 -0700)
With CONFIG_SLUB_DEBUG_ON it would panic during
ion_alloc()
 ion_buffer_create()
   io_heap_drain_freelist()

Signed-off-by: JP Abgrall <jpa@google.com>
drivers/gpu/ion/ion.c

index 200b1ad104a2289a5a94bc008c3a940d2b7f905f..d2d05139a2b0a899f51f20623783fc1d23396fc7 100644 (file)
@@ -1342,8 +1342,8 @@ static bool ion_heap_drain_freelist(struct ion_heap *heap)
                return false;
        rt_mutex_lock(&heap->lock);
        list_for_each_entry_safe(buffer, tmp, &heap->free_list, list) {
-               _ion_buffer_destroy(buffer);
                list_del(&buffer->list);
+               _ion_buffer_destroy(buffer);
        }
        BUG_ON(!list_empty(&heap->free_list));
        rt_mutex_unlock(&heap->lock);