Skip to content

Commit dbe80cf

Browse files
jan-kiszkaWim Van Sebroeck
authored andcommitted
watchdog: Start watchdog in watchdog_set_last_hw_keepalive only if appropriate
We must not pet a running watchdog when handle_boot_enabled is off because this will kick off automatic triggering before userland is running, defeating the purpose of the handle_boot_enabled control. Furthermore, don't ping in case watchdog_set_last_hw_keepalive was called incorrectly when the hardware watchdog is actually not running. Fixed: cef9572 ("watchdog: add support for adjusting last known HW keepalive time") Signed-off-by: Jan Kiszka <[email protected]> Reviewed-by: Guenter Roeck <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Guenter Roeck <[email protected]> Signed-off-by: Wim Van Sebroeck <[email protected]>
1 parent 585ba60 commit dbe80cf

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

drivers/watchdog/watchdog_dev.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1173,7 +1173,10 @@ int watchdog_set_last_hw_keepalive(struct watchdog_device *wdd,
11731173

11741174
wd_data->last_hw_keepalive = ktime_sub(now, ms_to_ktime(last_ping_ms));
11751175

1176-
return __watchdog_ping(wdd);
1176+
if (watchdog_hw_running(wdd) && handle_boot_enabled)
1177+
return __watchdog_ping(wdd);
1178+
1179+
return 0;
11771180
}
11781181
EXPORT_SYMBOL_GPL(watchdog_set_last_hw_keepalive);
11791182

0 commit comments

Comments
 (0)