From: Song Liu Date: Tue, 30 Apr 2024 06:02:35 +0000 (-0700) Subject: watchdog: handle comma separated nmi_watchdog command line X-Git-Tag: v6.10-rc1~98^2~9 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=602ba77361160d99c77e3dadf7d891364f8c71b3;p=thirdparty%2Fkernel%2Flinux.git watchdog: handle comma separated nmi_watchdog command line Per the document, the kernel can accept comma separated command line like nmi_watchdog=nopanic,0. However, the code doesn't really handle it. Fix the kernel to handle it properly. Link: https://lkml.kernel.org/r/20240430060236.1878002-1-song@kernel.org Signed-off-by: Song Liu Cc: Peter Zijlstra Signed-off-by: Andrew Morton --- diff --git a/kernel/watchdog.c b/kernel/watchdog.c index d7b2125503af3..7f54484de16f7 100644 --- a/kernel/watchdog.c +++ b/kernel/watchdog.c @@ -71,6 +71,7 @@ void __init hardlockup_detector_disable(void) static int __init hardlockup_panic_setup(char *str) { +next: if (!strncmp(str, "panic", 5)) hardlockup_panic = 1; else if (!strncmp(str, "nopanic", 7)) @@ -79,6 +80,12 @@ static int __init hardlockup_panic_setup(char *str) watchdog_hardlockup_user_enabled = 0; else if (!strncmp(str, "1", 1)) watchdog_hardlockup_user_enabled = 1; + while (*(str++)) { + if (*str == ',') { + str++; + goto next; + } + } return 1; } __setup("nmi_watchdog=", hardlockup_panic_setup);