From: Joel Fernandes <joelagnelf@nvidia.com>
To: linux-kernel@vger.kernel.org, Davidlohr Bueso <dave@stgolabs.net>,
"Paul E. McKenney" <paulmck@kernel.org>,
Josh Triplett <josh@joshtriplett.org>
Cc: Joel Fernandes <joelagnelf@nvidia.com>
Subject: [PATCH v1 4/6] torture: Don't leak shuffle_tmp_mask when shuffler kthread fails to start
Date: Sat, 18 Jul 2026 13:15:35 -0400 [thread overview]
Message-ID: <20260718171539.3781595-5-joelagnelf@nvidia.com> (raw)
In-Reply-To: <20260718171539.3781595-1-joelagnelf@nvidia.com>
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>
---
kernel/torture.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
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);
--
2.34.1
next prev parent reply other threads:[~2026-07-18 17:15 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-18 17:15 [PATCH v1 0/6] RCU and torture fixes and cleanups Joel Fernandes
2026-07-18 17:15 ` [PATCH v1 1/6] rcu: Remove unused expedited_need_qs field from rcu_state Joel Fernandes
2026-07-18 17:15 ` [PATCH v1 2/6] rcu: Remove unused rdp parameter from trace_rcu_this_gp() Joel Fernandes
2026-07-18 17:15 ` [PATCH v1 3/6] rcu: Remove unused func parameter from callback-enqueue functions Joel Fernandes
2026-07-18 17:15 ` Joel Fernandes [this message]
2026-07-18 17:15 ` [PATCH v1 5/6] scftorture: Count single_rpc offline failures in statistics output Joel Fernandes
2026-07-18 17:17 ` Joel Fernandes
2026-07-18 17:15 ` [PATCH v1 6/6] scftorture: Make invoker threads actually wait for all threads to start Joel Fernandes
2026-07-18 17:17 ` Joel Fernandes
2026-07-20 15:52 ` [PATCH v1 0/6] RCU and torture fixes and cleanups Paul E. McKenney
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260718171539.3781595-5-joelagnelf@nvidia.com \
--to=joelagnelf@nvidia.com \
--cc=dave@stgolabs.net \
--cc=josh@joshtriplett.org \
--cc=linux-kernel@vger.kernel.org \
--cc=paulmck@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®