diff options
| author | Guenter Roeck <linux@roeck-us.net> | 2026-10-27 09:02:57 -0700 |
|---|---|---|
| committer | Guenter Roeck <linux@roeck-us.net> | 2026-11-16 13:26:11 -0800 |
| commit | d22343336beb0fdfa583da80a08684f8e18878ec (patch) | |
| tree | 6b238f6b6494cc7f7b1870e03327cec5cef0d699 /rust/kernel | |
| parent | 4da537f3b55220b31e5967466d54daaa38203660 (diff) | |
watchdog: core: Prevent ping worker from re-arming timer on suspend
In watchdog_dev_suspend(), hrtimer_cancel() is called before
kthread_cancel_work_sync(). If the timer expired just before
hrtimer_cancel() and queued watchdog_ping_work(), the worker can run
and acquire wd_data->lock while kthread_cancel_work_sync() waits for it
to finish. Because no state flag indicates that the watchdog is
suspended, watchdog_worker_should_ping() returns true and
__watchdog_ping() re-arms wd_data->timer while the device is suspended.
Add a _WDOG_SUSPENDED internal status bit to wd_data->status, set it
under wd_data->lock in watchdog_dev_suspend(), clear it under
wd_data->lock in watchdog_dev_resume(), and check it in
watchdog_worker_should_ping(), watchdog_need_worker(), and
__watchdog_ping() so the timer cannot be armed while suspended.
Fixes: 60bcd91aafd2 ("watchdog: introduce watchdog_dev_suspend/resume")
Reviewed-by: Tzung-Bi Shih <tzungbi@kernel.org>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Link: https://patch.msgid.link/20261027160302.2519282-4-linux@roeck-us.net
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Diffstat (limited to 'rust/kernel')
0 files changed, 0 insertions, 0 deletions
