[PATCH] x86/tsc: Fix early boot crash with bare tsc_early_khz parameter

From: Thorsten Blum

Date: Tue Nov 10 2026 - 14:33:03 EST


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@xxxxxxxxxxxxxxx
Signed-off-by: Thorsten Blum <blum@xxxxxxxxxx>
---
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);