* [PATCH] x86/tsc: Fix early boot crash with bare tsc_early_khz parameter
@ 2026-11-10 15:05 Thorsten Blum
0 siblings, 0 replies; only message in thread
From: Thorsten Blum @ 2026-11-10 15:05 UTC (permalink / raw)
To: Thomas Gleixner, Ingo Molnar, Borislav Petkov, Dave Hansen, x86,
H. Peter Anvin, Peter Zijlstra (Intel),
Juergen Gross, Sean Christopherson, Wangyang Guo,
Krzysztof Piecuch
Cc: Thorsten Blum, Ingo Molnar, linux-kernel
When a bare tsc_early_khz parameter is specified on the kernel command
line without the '=' separator, early parameter parsing passes NULL to
tsc_early_khz_setup(), which dereferences it in kstrtouint() and can
crash the system during early boot.
Reject a NULL argument in tsc_early_khz_setup() by returning -EINVAL so
early parameter parsing reports the malformed option instead.
Fixes: bd35c77e32e4 ("x86/tsc: Add tsc_early_khz command line parameter")
Cc: stable@vger.kernel.org
Signed-off-by: Thorsten Blum <blum@kernel.org>
---
arch/x86/kernel/tsc.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/arch/x86/kernel/tsc.c b/arch/x86/kernel/tsc.c
index 723347e2cf7f..82ff4b7490a0 100644
--- a/arch/x86/kernel/tsc.c
+++ b/arch/x86/kernel/tsc.c
@@ -70,6 +70,9 @@ static DEFINE_PER_CPU_ALIGNED(struct cyc2ns, cyc2ns);
static int __init tsc_early_khz_setup(char *buf)
{
+ if (!buf)
+ return -EINVAL;
+
return kstrtouint(buf, 0, &tsc_early_khz);
}
early_param("tsc_early_khz", tsc_early_khz_setup);
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2026-11-10 15:06 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-10 15:05 [PATCH] x86/tsc: Fix early boot crash with bare tsc_early_khz parameter Thorsten Blum
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®