mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-10-26 10:57:38 +08:00
torture: Don't leak shuffle_tmp_mask when shuffler kthread fails to start
If torture_shuffle_init() successfully allocates shuffle_tmp_mask but then fails to create the torture_shuffle kthread, the cpumask is never freed. Free the cpumask directly on the kthread-creation error path. Signed-off-by: Joel Fernandes <joelagnelf@nvidia.com> Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
This commit is contained in:
1 parent
ed55bb9150
commit
aaf43c458c
1 file changed
+6
-1
+6
-1
@@ -577,6 +577,8 @@ static int torture_shuffle(void *arg)
|
||||
*/
|
||||
int torture_shuffle_init(long shuffint)
|
||||
{
|
||||
int ret;
|
||||
|
||||
shuffle_interval = shuffint;
|
||||
|
||||
shuffle_idle_cpu = -1;
|
||||
@@ -587,7 +589,10 @@ int torture_shuffle_init(long shuffint)
|
||||
}
|
||||
|
||||
/* Create the shuffler thread */
|
||||
return torture_create_kthread(torture_shuffle, NULL, shuffler_task);
|
||||
ret = torture_create_kthread(torture_shuffle, NULL, shuffler_task);
|
||||
if (ret)
|
||||
free_cpumask_var(shuffle_tmp_mask);
|
||||
return ret;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(torture_shuffle_init);
|
||||
|
||||
|
||||
Reference in new issue
Block a user