mirror of
https://github.com/linux-msm/laptops-kernel.git
synced 2026-08-13 14:19:53 -07:00
timers/migration: Fix memory leak in tmigr_setup_groups() error path
When the WARN_ON_ONCE(i >= tmigr_hierarchy_levels) assertion triggers,
the function returns -EINVAL without freeing the 'stack' memory allocated
via kzalloc_objs() at the beginning of the function.
Add kfree(stack) before returning to prevent the memory leak.
Fixes: 6c181b5667 ("timers/migration: Convert "while" loops to use "for"")
Signed-off-by: Malaya Kumar Rout <malayarout91@gmail.com>
Signed-off-by: Thomas Gleixner <tglx@kernel.org>
Link: https://patch.msgid.link/20260704085533.87098-1-malayarout91@gmail.com
This commit is contained in:
committed by
Thomas Gleixner
parent
f2eee7e31c
commit
eddfded419
@@ -1847,8 +1847,10 @@ static int tmigr_setup_groups(struct tmigr_hierarchy *hier, unsigned int cpu,
|
||||
}
|
||||
|
||||
/* Assert single root without parent */
|
||||
if (WARN_ON_ONCE(i >= tmigr_hierarchy_levels))
|
||||
if (WARN_ON_ONCE(i >= tmigr_hierarchy_levels)) {
|
||||
kfree(stack);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
for (; i >= start_lvl; i--) {
|
||||
group = stack[i];
|
||||
|
||||
Reference in New Issue
Block a user