Commit 148bb043 authored by Axel Lin's avatar Axel Lin Committed by Santosh Shilimkar

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: default avatarAxel Lin <axel.lin@ingics.com>
Signed-off-by: default avatarSantosh Shilimkar <ssantosh@kernel.org>
parent 39179cb5
...@@ -1306,14 +1306,14 @@ static void knav_free_queue_ranges(struct knav_device *kdev) ...@@ -1306,14 +1306,14 @@ static void knav_free_queue_ranges(struct knav_device *kdev)
static void knav_queue_free_regions(struct knav_device *kdev) static void knav_queue_free_regions(struct knav_device *kdev)
{ {
struct knav_region *region; struct knav_region *region;
struct knav_pool *pool; struct knav_pool *pool, *tmp;
unsigned size; unsigned size;
for (;;) { for (;;) {
region = first_region(kdev); region = first_region(kdev);
if (!region) if (!region)
break; 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); knav_pool_destroy(pool);
size = region->virt_end - region->virt_start; size = region->virt_end - region->virt_start;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment