gpu: ion: fix kfree/list_del order
authorJP Abgrall <jpa@google.com>
Fri, 13 Dec 2013 22:24:36 +0000 (14:24 -0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 14 Dec 2013 16:55:41 +0000 (08:55 -0800)
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>
[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 b965f155953620b2d981d5698328b7f81f217b1d..b2dcee5ceae5f3ea16d7d2bdb9562a97d5fb165c 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);