From: sashiko-bot@kernel.org
To: "Antonio Borneo" <antonio.borneo@foss.st.com>
Cc: linux-watchdog@vger.kernel.org
Subject: Re: [PATCH] watchdog: stm32_iwdg: use managed variant of dev_pm_set_wake_irq()
Date: Mon, 16 Nov 2026 19:09:42 +0000 [thread overview]
Message-ID: <sashiko-outbox-217543@kernel.org> (raw)
In-Reply-To: <20261116190130.1191501-1-antonio.borneo@foss.st.com>
Thank you for your contribution! Sashiko AI review found no new issues
in this patch, but noticed 1 related pre-existing issue it does not
introduce:
- [Medium] watchdog: stm32_iwdg: NULL pointer dereference in
stm32_iwdg_isr() [1]
--
commit faff7513f5bea59db8a5e975f7eb126068ba7dc8
Author: Antonio Borneo <antonio.borneo@foss.st.com>
watchdog: stm32_iwdg: use managed variant of dev_pm_set_wake_irq()
This commit switches stm32_iwdg_irq_init() to use devm_pm_set_wake_irq()
so the wake IRQ is automatically detached on probe failure or driver
unbind.
Link: https://sashiko.dev/#/message/20261116132416.1184447-3-antonio.borneo%40foss.st.com
Link: https://sashiko.dev/#/log/249869
> diff --git a/drivers/watchdog/stm32_iwdg.c b/drivers/watchdog/stm32_iwdg.c
> index a8d2db2d3cf8b..f1056f8100cf0 100644
> --- a/drivers/watchdog/stm32_iwdg.c
> +++ b/drivers/watchdog/stm32_iwdg.c
> @@ -298,7 +298,7 @@ static int stm32_iwdg_irq_init(struct platform_device *pdev,
> if (ret)
> return ret;
>
> - ret = dev_pm_set_wake_irq(dev, irq);
> + ret = devm_pm_set_wake_irq(dev, irq);
> if (ret)
> return ret;
> }
[Severity: Medium]
This problem wasn't introduced by this patch, but can stm32_iwdg_isr() hit
a NULL pointer dereference [1] if the interrupt fires before
watchdog_set_drvdata() runs?
stm32_iwdg_probe() calls stm32_iwdg_irq_init(), which requests the IRQ,
before populating wdd->driver_data:
drivers/watchdog/stm32_iwdg.c:stm32_iwdg_probe() {
...
ret = stm32_iwdg_irq_init(pdev, wdt);
if (ret)
return ret;
watchdog_set_drvdata(wdd, wdt);
...
}
If the watchdog is already running with the early-wakeup interrupt enabled
(for example across driver rebind) and the IRQ fires in that window,
stm32_iwdg_isr() gets NULL from watchdog_get_drvdata(wdd) and dereferences
wdt->regs.
[1] https://sashiko.dev/#/bug/linux-ebf60aef-da57-4fba-a11d-75c387866884
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261116190130.1191501-1-antonio.borneo@foss.st.com?part=1
next prev parent reply other threads:[~2026-11-16 19:09 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-16 19:01 [PATCH] watchdog: stm32_iwdg: use managed variant of dev_pm_set_wake_irq() Antonio Borneo
2026-11-16 19:09 ` sashiko-bot [this message]
2026-11-16 20:36 ` Guenter Roeck
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=sashiko-outbox-217543@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=antonio.borneo@foss.st.com \
--cc=linux-watchdog@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.