diff mbox

gpu: ion: Use safe version of list iterator

Message ID CAMcxFTQu5eFSQ1v55aWtfm8Pi6Z+Ai+m8cz2PZrNr_42qMyo_Q@mail.gmail.com
State New
Headers show

Commit Message

Nishanth Peethambaran Feb. 9, 2013, 6:05 p.m. UTC
On allocation or kmalloc failure in system heap allocate, the exit path
iterates over the allocated page infos and frees the allocated pages
and page info. The same page info structure is used as loop iterator.
Use the safe version of list iterator.

Signed-off-by: Nishanth Peethambaran <nishanth@broadcom.com>
---
 drivers/gpu/ion/ion_system_heap.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox

Patch

diff --git a/drivers/gpu/ion/ion_system_heap.c
b/drivers/gpu/ion/ion_system_heap.c
index c1061a8..d079e2b 100644
--- a/drivers/gpu/ion/ion_system_heap.c
+++ b/drivers/gpu/ion/ion_system_heap.c
@@ -200,7 +200,7 @@  static int ion_system_heap_allocate(struct ion_heap *heap,
 err1:
 	kfree(table);
 err:
-	list_for_each_entry(info, &pages, list) {
+	list_for_each_entry_safe(info, tmp_info, &pages, list) {
 		free_buffer_page(sys_heap, buffer, info->page, info->order);
 		kfree(info);
 	}