Skip to content

Commit

Permalink
watchdog: Avoid kernel crash when disabling watchdog
Browse files Browse the repository at this point in the history
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.

Signed-off-by: Stephane Eranian <eranian@google.com>
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
LKML-Reference: <4c8f7a23.cae9d80a.2c11.0bb4@mx.google.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
  • Loading branch information
Stephane Eranian authored and Ingo Molnar committed Sep 15, 2010
1 parent 3aabae7 commit d9ca07a
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions kernel/watchdog.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down

0 comments on commit d9ca07a

Please sign in to comment.