Commit 39d2da21 authored by Ulrich Obergfell's avatar Ulrich Obergfell Committed by Linus Torvalds

kernel/watchdog.c: fix race between proc_watchdog_thresh() and watchdog_timer_fn()

Theoretically it is possible that the watchdog timer expires right at the
time when a user sets 'watchdog_thresh' to zero (note: this disables the
lockup detectors).  In this scenario, the is_softlockup() function - which
is called by the timer - could produce a false positive.

Fix this by checking the current value of 'watchdog_thresh'.
Signed-off-by: default avatarUlrich Obergfell <>
Acked-by: default avatarDon Zickus <>
Reviewed-by: default avatarAaron Tomlin <>
Cc: Ulrich Obergfell <>
Signed-off-by: default avatarAndrew Morton <>
Signed-off-by: default avatarLinus Torvalds <>
parent a2a45b85
......@@ -289,7 +289,7 @@ static int is_softlockup(unsigned long touch_ts)
unsigned long now = get_timestamp();
if (watchdog_enabled & SOFT_WATCHDOG_ENABLED) {
if ((watchdog_enabled & SOFT_WATCHDOG_ENABLED) && watchdog_thresh){
/* Warn about unreasonable delays. */
if (time_after(now, touch_ts + get_softlockup_thresh()))
return now - touch_ts;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment