Re: [PATCH net v5 04/14] net: pse-pd: do not keep a failed IRQ in pcdev->irq
From: netdev-bot+sashiko
Date: Fri Nov 20 2026 - 01:42:16 EST
Thank you for your contribution! Sashiko AI review found 1 potential
issue(s) to consider.
Critical: 0 · High: 0 · Medium: 1 · Low: 0
If you believe none of the issues are legitimate, please reply to each
issue of Medium severity or higher and explain why the AI is wrong.
If any of them are legitimate and you plan to respin, please let patchwork
know by including "pw-bot: cr" as a separate line at the end of your reply
(one such reply per series is enough).
- [Medium] This patch keeps pcdev->irq accurate only when the IRQ request
fails.
--
net: pse-pd: do not keep a failed IRQ in pcdev->irq
This patch clears pcdev->irq in devm_pse_irq_helper() when
devm_request_threaded_irq() fails. Without that, the failed probe's
pse_controller_unregister() calls disable_irq() on a line the controller
does not own. pcdev->irq is now set before the request because pse_isr()
can read it as soon as the IRQ is enabled.
> diff --git a/drivers/net/pse-pd/pse_core.c b/drivers/net/pse-pd/pse_core.c
> index 0cce17670d0b9..0894613515e0d 100644
> --- a/drivers/net/pse-pd/pse_core.c
> +++ b/drivers/net/pse-pd/pse_core.c
> @@ -1341,14 +1341,20 @@ int devm_pse_irq_helper(struct pse_controller_dev *pcdev, int irq,
> if (!h->notifs_mask)
> return -ENOMEM;
>
> + /* pse_isr() can run as soon as the IRQ is enabled, and
> + * pse_pw_d_is_sw_pw_control() reads pcdev->irq.
> + */
> + pcdev->irq = irq;
> ret = devm_request_threaded_irq(dev, irq, NULL, pse_isr,
> IRQF_ONESHOT | irq_flags,
> irq_name, h);
> - if (ret)
> + if (ret) {
> + pcdev->irq = 0;
> dev_err(pcdev->dev, "Failed to request IRQ %d\n", irq);
> + return ret;
> + }
[Severity: Medium]
This covers the failed request. Can pcdev->irq still go stale on a normal
unbind?
The only caller of devm_pse_irq_helper() is tps23881. It registers the
controller devres first and requests the IRQ after that:
drivers/net/pse-pd/tps23881.c:tps23881_i2c_probe() {
...
ret = devm_pse_controller_register(dev, &priv->pcdev);
...
return tps23881_setup_irq(priv, client->irq);
}
tps23881_setup_irq() then calls devm_pse_irq_helper(). Devres releases in
LIFO order, so on unbind or rmmod the teardown runs:
devres_release_all()
devm_irq_release()
free_irq()
devm_pse_controller_release()
pse_controller_unregister()
By that point pse_controller_unregister() no longer owns the line, but it
still does:
if (pcdev->irq)
disable_irq(pcdev->irq);
This is the same problem the commit message describes, except that the
stale pcdev->irq comes from devres teardown and not from a failed request.
Suppose another device requests the same line between free_irq() and
disable_irq(). __setup_irq() resets the depth to 0, and this disable_irq()
then leaves the line masked for that device, with no matching
enable_irq().
A future caller passing IRQF_SHARED through the exported irq_flags
argument would hit this on every unbind, because the other sharers stay on
the line after free_irq().
Could pcdev->irq also be cleared when the devm IRQ is released? One option
is a devm action registered before devm_request_threaded_irq() that resets
pcdev->irq. Then pse_controller_unregister() would skip disable_irq() on
this path too.
>
> - pcdev->irq = irq;
> - return ret;
> + return 0;
> }
> EXPORT_SYMBOL_GPL(devm_pse_irq_helper);
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261118183957.2031311-1-github%40szelinsky.de