kernel/watchdog.c: fix race between proc_watchdog_thresh() and watchdog_timer_fn()
authorUlrich Obergfell <uobergfe@redhat.com>
Fri, 6 Nov 2015 02:44:56 +0000 (18:44 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Fri, 6 Nov 2015 03:34:48 +0000 (19:34 -0800)
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 <uobergfe@redhat.com>
Acked-by: Don Zickus <dzickus@redhat.com>
Reviewed-by: Aaron Tomlin <atomlin@redhat.com>
Cc: Ulrich Obergfell <uobergfe@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
kernel/watchdog.c

index 84c4744d19775c476addcfb87b9ee50b34f08951..18f34cf75f741e2a63db6dc6c522dfa2e03d1a54 100644 (file)
@@ -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;
This page took 0.025607 seconds and 5 git commands to generate.