From: Bradley Morgan <include@grrlz.net>
To: akpm@linux-foundation.org
Cc: pmladek@suse.com, feng.tang@linux.alibaba.com, include@grrlz.net,
linux-kernel@vger.kernel.org
Subject: [PATCH] panic: stop CPUs that lose the panic_redirect_cpu race
Date: Tue, 7 Jul 2026 17:22:52 +0000 [thread overview]
Message-ID: <20260707172252.4842-1-include@grrlz.net> (raw)
Loser of the redirect cmpxchg must stop, not fall through to
panic_try_start().
This issue was found by sashiko [1].
[1] https://sashiko.dev/#/patchset/20260705164123.18746-1-include%40grrlz.net
Signed-off-by: Bradley Morgan <include@grrlz.net>
---
kernel/panic.c | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)
diff --git a/kernel/panic.c b/kernel/panic.c
index 03f1eef07b17..8ba3ec12db3a 100644
--- a/kernel/panic.c
+++ b/kernel/panic.c
@@ -400,12 +400,9 @@ static bool panic_try_force_cpu(const char *fmt, va_list args)
if (panic_in_progress())
return false;
- /*
- * Only one CPU can do the redirect. Use atomic cmpxchg to ensure
- * we don't race with another CPU also trying to redirect.
- */
+ /* Only one CPU redirects, the loser stops and lets it finish. */
if (!atomic_try_cmpxchg(&panic_redirect_cpu, &old_cpu, this_cpu))
- return false;
+ return true;
/*
* Use dynamically allocated buffer if available, otherwise
--
2.53.0
next reply other threads:[~2026-07-07 17:22 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-07 17:22 Bradley Morgan [this message]
2026-07-07 18:12 ` [PATCH] panic: stop CPUs that lose the panic_redirect_cpu race Andrew Morton
2026-07-07 18:15 ` Bradley Morgan
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=20260707172252.4842-1-include@grrlz.net \
--to=include@grrlz.net \
--cc=akpm@linux-foundation.org \
--cc=feng.tang@linux.alibaba.com \
--cc=linux-kernel@vger.kernel.org \
--cc=pmladek@suse.com \
/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