From: Ulrich Obergfell Date: Fri, 6 Nov 2015 02:44:56 +0000 (-0800) Subject: kernel/watchdog.c: fix race between proc_watchdog_thresh() and watchdog_timer_fn() X-Git-Tag: v4.4-rc1~99^2~136 X-Git-Url: https://git.kernel.dk/?a=commitdiff_plain;h=39d2da2161d35de301ec5397ce9103c68b883054;p=linux-2.6-block.git 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: Ulrich Obergfell Acked-by: Don Zickus Reviewed-by: Aaron Tomlin Cc: Ulrich Obergfell Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/kernel/watchdog.c b/kernel/watchdog.c index 84c4744d1977..18f34cf75f74 100644 --- a/kernel/watchdog.c +++ b/kernel/watchdog.c @@ -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;