]> git.karo-electronics.de Git - linux-beck.git/commitdiff
soc: ti: knav_qmss_queue: Use list_for_each_entry_safe to prevent use after free
authorAxel Lin <axel.lin@ingics.com>
Mon, 3 Nov 2014 18:21:54 +0000 (10:21 -0800)
committerSantosh Shilimkar <santosh.shilimkar@oracle.com>
Mon, 3 Nov 2014 18:22:06 +0000 (10:22 -0800)
list_for_each_entry_safe() is necessary if list objects are deleted from
the list while traversing it.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Santosh Shilimkar <ssantosh@kernel.org>
drivers/soc/ti/knav_qmss_queue.c

index 6f22d5622c98d6996356d91bb236fda3566d84a7..9b8dd67326811264e226117b04c1c33b92d92fd1 100644 (file)
@@ -1306,14 +1306,14 @@ static void knav_free_queue_ranges(struct knav_device *kdev)
 static void knav_queue_free_regions(struct knav_device *kdev)
 {
        struct knav_region *region;
-       struct knav_pool *pool;
+       struct knav_pool *pool, *tmp;
        unsigned size;
 
        for (;;) {
                region = first_region(kdev);
                if (!region)
                        break;
-               list_for_each_entry(pool, &region->pools, region_inst)
+               list_for_each_entry_safe(pool, tmp, &region->pools, region_inst)
                        knav_pool_destroy(pool);
 
                size = region->virt_end - region->virt_start;