* [PATCH v1] watchdog: unregister PM notifier on watchdog unregister
@ 2026-06-01 19:20 Yuho Choi
2026-06-08 18:57 ` Guenter Roeck
0 siblings, 1 reply; 2+ messages in thread
From: Yuho Choi @ 2026-06-01 19:20 UTC (permalink / raw)
To: Wim Van Sebroeck, Guenter Roeck; +Cc: linux-watchdog, linux-kernel, Yuho Choi
watchdog_register_device() registers wdd->pm_nb when
WDOG_NO_PING_ON_SUSPEND is set, but watchdog_unregister_device() does not
remove it. This leaves an embedded notifier block on the PM notifier chain
after the watchdog device has been unregistered.
A later suspend/resume notification can then call watchdog_pm_notifier()
with a stale watchdog_device pointer, or at minimum after wdd->wd_data has
been cleared by watchdog_dev_unregister().
Unregister the PM notifier before tearing down the watchdog device.
Fixes: 60bcd91aafd2 ("watchdog: introduce watchdog_dev_suspend/resume")
Signed-off-by: Yuho Choi <dbgh9129@gmail.com>
---
drivers/watchdog/watchdog_core.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/watchdog/watchdog_core.c b/drivers/watchdog/watchdog_core.c
index 8300520688d0..6c087b4ef5dd 100644
--- a/drivers/watchdog/watchdog_core.c
+++ b/drivers/watchdog/watchdog_core.c
@@ -391,6 +391,9 @@ static void __watchdog_unregister_device(struct watchdog_device *wdd)
if (test_bit(WDOG_STOP_ON_REBOOT, &wdd->status))
unregister_reboot_notifier(&wdd->reboot_nb);
+ if (test_bit(WDOG_NO_PING_ON_SUSPEND, &wdd->status))
+ unregister_pm_notifier(&wdd->pm_nb);
+
watchdog_dev_unregister(wdd);
ida_free(&watchdog_ida, wdd->id);
}
--
2.43.0
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH v1] watchdog: unregister PM notifier on watchdog unregister
2026-06-01 19:20 [PATCH v1] watchdog: unregister PM notifier on watchdog unregister Yuho Choi
@ 2026-06-08 18:57 ` Guenter Roeck
0 siblings, 0 replies; 2+ messages in thread
From: Guenter Roeck @ 2026-06-08 18:57 UTC (permalink / raw)
To: Yuho Choi; +Cc: Wim Van Sebroeck, linux-watchdog, linux-kernel
On Mon, Jun 01, 2026 at 03:20:05PM -0400, Yuho Choi wrote:
> watchdog_register_device() registers wdd->pm_nb when
> WDOG_NO_PING_ON_SUSPEND is set, but watchdog_unregister_device() does not
> remove it. This leaves an embedded notifier block on the PM notifier chain
> after the watchdog device has been unregistered.
>
> A later suspend/resume notification can then call watchdog_pm_notifier()
> with a stale watchdog_device pointer, or at minimum after wdd->wd_data has
> been cleared by watchdog_dev_unregister().
>
> Unregister the PM notifier before tearing down the watchdog device.
>
> Fixes: 60bcd91aafd2 ("watchdog: introduce watchdog_dev_suspend/resume")
> Signed-off-by: Yuho Choi <dbgh9129@gmail.com>
Applied.
Thanks,
Guenter
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-06-08 18:57 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-06-01 19:20 [PATCH v1] watchdog: unregister PM notifier on watchdog unregister Yuho Choi
2026-06-08 18:57 ` Guenter Roeck
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®