Skip to contentSkip to conversation

panic-fix-va_list-reuse-in-panic_try_force_cpu.patch removed from -mm tree

merged mm-nonmm-stable Andrew Morton 1 participant 1 message Oct 7 Stable branch

lore
Share & tools
lore

Andrew Morton

author tree notice Applied
#0 lore raw

The quilt patch titled
Subject: panic: fix va_list reuse in panic_try_force_cpu()
has been removed from the -mm tree. Its filename was
panic-fix-va_list-reuse-in-panic_try_force_cpu.patch

This patch was dropped because it was merged into the mm-nonmm-stable branch of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm

------------------------------------------------------
From: Bradley Morgan <[email protected]>
Subject: panic: fix va_list reuse in panic_try_force_cpu()
Date: Wed, 16 Sep 2026 18:29:54 +0000

vsnprintf() consumes the caller's va_list. When the redirect fails, vpanic() reuses it for the panic message, which is undefined behavior. Use va_copy().

Fixes 2e171ab29f91 ("panic: add panic_force_cpu= parameter to redirect panic to a specific CPU")
Cc Guenetr Roeck <[email protected]>
Cc Sashiko <[email protected]>
Cc Wang Jinchao <[email protected]>
Cc Wim Van Sebroeck <[email protected]>

---

 kernel/panic.c |    7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
kernel/panic.c renamed from kernel/panic.c~panic-fix-va_list-reuse-in-panic_try_force_cpu +6 -1
@@ -417,7 +417,12 @@ static bool panic_try_force_cpu(const ch
 	 * fall back to static message for early boot panics or allocation failure.
 	 */
 	if (panic_force_buf) {
-		vsnprintf(panic_force_buf, PANIC_MSG_BUFSZ, fmt, args);
+		va_list ap;
+
+		/* Do not consume args, the caller reuses it if we fail */
+		va_copy(ap, args);
+		vsnprintf(panic_force_buf, PANIC_MSG_BUFSZ, fmt, ap);
+		va_end(ap);
 		msg = panic_force_buf;
 	} else {
 		msg = "Redirected panic (buffer unavailable)";

_

Patches currently in -mm which might be from [email protected] are

watchdog-perf-one-digit-too-short-in-the-raw-event-config-copy.patch