From: sashiko-bot@kernel.org
To: "Tzung-Bi Shih" <tzungbi@kernel.org>
Cc: linux-watchdog@vger.kernel.org
Subject: Re: [PATCH v2 5/9] watchdog: msc313e: Fix spurious reset on suspend
Date: Fri, 28 Aug 2026 16:25:41 +0000 [thread overview]
Message-ID: <20260828162542.4BE6F1F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260828161348.13212-6-tzungbi@kernel.org>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] Calling `watchdog_stop_ping_on_suspend()` opts the driver into a buggy watchdog core feature that leaks the PM notifier, causing a Use-After-Free upon device unbind or module unload.
--
commit f0550ce9d86164c3e7cb8c64fecb979c9936c149
Author: Tzung-Bi Shih <tzungbi@kernel.org>
watchdog: msc313e: Fix spurious reset on suspend
This commit addresses a spurious system reset on suspend when the watchdog
is started by the bootloader but not yet opened by userspace. It checks
both active and hardware running states, and stops the ping worker during
suspend.
> diff --git a/drivers/watchdog/msc313e_wdt.c b/drivers/watchdog/msc313e_wdt.c
> index 86e72aea96855..9cfe059fd31a7 100644
> --- a/drivers/watchdog/msc313e_wdt.c
> +++ b/drivers/watchdog/msc313e_wdt.c
> @@ -157,6 +157,7 @@ static int msc313e_wdt_probe(struct platform_device *pdev)
> watchdog_init_timeout(&priv->wdev, timeout, dev);
> watchdog_stop_on_reboot(&priv->wdev);
> watchdog_stop_on_unregister(&priv->wdev);
> + watchdog_stop_ping_on_suspend(&priv->wdev);
[Severity: High]
Does adding this call expose the driver to a use-after-free regression
during device unbind or module unload?
Calling watchdog_stop_ping_on_suspend() sets the WDOG_NO_PING_ON_SUSPEND
flag. The watchdog core sees this flag and registers wdd->pm_nb to the
global PM notifier chain.
However, the core unregistration path in __watchdog_unregister_device()
fails to detach the PM notifier:
drivers/watchdog/watchdog_core.c:__watchdog_unregister_device() {
...
if (test_bit(WDOG_STOP_ON_REBOOT, &wdd->status))
unregister_reboot_notifier(&wdd->reboot_nb);
watchdog_dev_unregister(wdd);
ida_free(&watchdog_ida, wdd->id);
...
}
When the driver is unbound (e.g. via sysfs) or the module is unloaded, the
driver's memory containing pm_nb is freed, leaving a dangling pointer in the
global PM notifier list. The next system suspend could then trigger a panic.
While the missing unregister logic is a pre-existing flaw in the watchdog
core, this patch newly exposes the msc313e_wdt driver to this issue.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260828161348.13212-1-tzungbi@kernel.org?part=5
next prev parent reply other threads:[~2026-08-28 16:25 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-28 16:13 [PATCH v2 0/9] watchdog: msc313e: Fix issues Sashiko reported Tzung-Bi Shih
2026-08-28 16:13 ` [PATCH v2 1/9] watchdog: msc313e: Fix NULL pointer dereference in PM callbacks Tzung-Bi Shih
2026-09-09 21:07 ` Guenter Roeck
2026-08-28 16:13 ` [PATCH v2 2/9] watchdog: msc313e: Avoid division by zero Tzung-Bi Shih
2026-09-09 21:08 ` Guenter Roeck
2026-08-28 16:13 ` [PATCH v2 3/9] watchdog: msc313e: Fix clock leak and spurious timer in settimeout() Tzung-Bi Shih
2026-09-09 21:10 ` Guenter Roeck
2026-08-28 16:13 ` [PATCH v2 4/9] watchdog: msc313e: Enable clock before accessing hardware registers Tzung-Bi Shih
2026-08-28 16:25 ` sashiko-bot
2026-09-09 21:14 ` Guenter Roeck
2026-09-12 16:36 ` Tzung-Bi Shih
2026-08-28 16:13 ` [PATCH v2 5/9] watchdog: msc313e: Fix spurious reset on suspend Tzung-Bi Shih
2026-08-28 16:25 ` sashiko-bot [this message]
2026-09-09 21:16 ` Guenter Roeck
2026-09-09 23:02 ` Guenter Roeck
2026-08-28 16:13 ` [PATCH v2 6/9] watchdog: msc313e: Fix undefined behavior Tzung-Bi Shih
2026-09-09 21:17 ` Guenter Roeck
2026-08-28 16:13 ` [PATCH v2 7/9] watchdog: msc313e: Sync timeout value if WDT was running at boot Tzung-Bi Shih
2026-08-28 16:22 ` sashiko-bot
2026-09-09 21:19 ` Guenter Roeck
2026-08-28 16:13 ` [PATCH v2 8/9] watchdog: msc313e: Propagate error code in resume() Tzung-Bi Shih
2026-08-28 16:27 ` sashiko-bot
2026-09-09 21:21 ` Guenter Roeck
2026-08-28 16:13 ` [PATCH v2 9/9] watchdog: msc313e: Replace commas with semicolons in probe() Tzung-Bi Shih
2026-09-09 21:22 ` Guenter Roeck
2026-08-28 16:20 ` [PATCH v2 0/9] watchdog: msc313e: Fix issues Sashiko reported Daniel Palmer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260828162542.4BE6F1F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=linux-watchdog@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=tzungbi@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox