summaryrefslogtreecommitdiff
path: root/kernel
diff options
context:
space:
mode:
authorJoel Fernandes <joelagnelf@nvidia.com>2026-07-18 13:15:35 -0400
committerPaul E. McKenney <paulmck@kernel.org>2026-08-14 14:59:21 -0700
commitaaf43c458c491748ae79f8e6afc39fd09a36e77b (patch)
tree915c912fe98028fa4d6b99d6a152efa6422109d1 /kernel
parented55bb915047934acd28e2f0ea1ef9586b254bf0 (diff)
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>
Diffstat (limited to 'kernel')
-rw-r--r--kernel/torture.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/kernel/torture.c b/kernel/torture.c
index 77cb3589b19f..8c4e6b2fe8ba 100644
--- a/kernel/torture.c
+++ b/kernel/torture.c
@@ -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);