Skip to contentSkip to conversation

watchdog: avoid kernel crash when disabling watchdog

PATCH In review Stephane Eranian 1 participant 2 messages Sep 14, 2010 – Sep 15, 2010

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 watchdog: avoid kernel crash when disabling watchdog

In case you boot with the watchdog disabled, i.e., nowatchdog, then, if you try to disable it via /proc/sys/kernel/watchdog, you get a kernel crash. The reason is that you are trying to cancel a hrtimer which has never been initialized.

This patch fixes this by skipping execution of watchdog_disable_all_cpus() when the watchdog is marked disabled from boot.

--

kernel/watchdog.c +3 -0
index 69a3d44..f335067 100644
@@ -473,6 +473,9 @@ static void watchdog_disable_all_cpus(void)
 {
 	int cpu;
 
+	if (no_watchdog)
+		return;
+
 	for_each_online_cpu(cpu)
 		watchdog_disable(cpu);
 
#1 lore raw

[tip:perf/core] watchdog: Avoid kernel crash when disabling watchdog

Commit-ID:  d9ca07a05ce1c42ac9717e54eaea4546a3a80978
Gitweb:     http://git.kernel.org/tip/d9ca07a05ce1c42ac9717e54eaea4546a3a80978
Author:     Stephane Eranian <[email protected]>
AuthorDate: Tue, 14 Sep 2010 15:34:01 +0200
Committer:  Ingo Molnar <[email protected]>
CommitDate: Wed, 15 Sep 2010 10:43:58 +0200

watchdog: Avoid kernel crash when disabling watchdog

In case you boot with the watchdog disabled, i.e., nowatchdog, then, if you try to disable it via /proc/sys/kernel/watchdog, you get a kernel crash. The reason is that you are trying to cancel a hrtimer which has never been initialized.

This patch fixes this by skipping execution of watchdog_disable_all_cpus() when the watchdog is marked disabled from boot.

LKML-Reference: <[email protected]>

---
 kernel/watchdog.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
kernel/watchdog.c +3 -0
index fa71aeb..89eadbb 100644
@@ -473,6 +473,9 @@ static void watchdog_disable_all_cpus(void)
 {
 	int cpu;
 
+	if (no_watchdog)
+		return;
+
 	for_each_online_cpu(cpu)
 		watchdog_disable(cpu);