diff options
author | Axel Lin <axel.lin@ingics.com> | 2014-11-03 13:21:54 -0500 |
---|---|---|
committer | Santosh Shilimkar <santosh.shilimkar@oracle.com> | 2014-11-03 13:22:06 -0500 |
commit | 148bb0439adeeae466dca31dd4c643e194bee023 (patch) | |
tree | e8bfa8d36d8493c96c7409248f3d2b68fd5c097e | |
parent | 39179cb5b789e0c0275ccb8fa83cfaf9257d1474 (diff) |
soc: ti: knav_qmss_queue: Use list_for_each_entry_safe to prevent use after free
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>
-rw-r--r-- | drivers/soc/ti/knav_qmss_queue.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/soc/ti/knav_qmss_queue.c b/drivers/soc/ti/knav_qmss_queue.c index 6f22d5622c98..9b8dd6732681 100644 --- a/drivers/soc/ti/knav_qmss_queue.c +++ b/drivers/soc/ti/knav_qmss_queue.c | |||
@@ -1306,14 +1306,14 @@ static void knav_free_queue_ranges(struct knav_device *kdev) | |||
1306 | static void knav_queue_free_regions(struct knav_device *kdev) | 1306 | static void knav_queue_free_regions(struct knav_device *kdev) |
1307 | { | 1307 | { |
1308 | struct knav_region *region; | 1308 | struct knav_region *region; |
1309 | struct knav_pool *pool; | 1309 | struct knav_pool *pool, *tmp; |
1310 | unsigned size; | 1310 | unsigned size; |
1311 | 1311 | ||
1312 | for (;;) { | 1312 | for (;;) { |
1313 | region = first_region(kdev); | 1313 | region = first_region(kdev); |
1314 | if (!region) | 1314 | if (!region) |
1315 | break; | 1315 | break; |
1316 | list_for_each_entry(pool, ®ion->pools, region_inst) | 1316 | list_for_each_entry_safe(pool, tmp, ®ion->pools, region_inst) |
1317 | knav_pool_destroy(pool); | 1317 | knav_pool_destroy(pool); |
1318 | 1318 | ||
1319 | size = region->virt_end - region->virt_start; | 1319 | size = region->virt_end - region->virt_start; |