Netdev List
 help / color / mirror / Atom feed
From: netdev-bot+sashiko@kernel.org
To: github@szelinsky.de
Cc: o.rempel@pengutronix.de, kory.maincent@bootlin.com,
	andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@kernel.org,
	kuba@kernel.org, pabeni@redhat.com, horms@kernel.org,
	broonie@kernel.org, lgirdwood@gmail.com,
	maxime.chevallier@bootlin.com, kyle.swenson@est.tech,
	ross@r-sc.ca, netdev-bot+sashiko@kernel.org,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH net v3 08/14] net: pse-pd: stop async event sources before freeing PI data in unregister
Date: Thu, 05 Nov 2026 10:08:35 +0000	[thread overview]
Message-ID: <179387331572.488856.14138423432886028016@kernel.org> (raw)
In-Reply-To: <20261103220217.1131971-9-github@szelinsky.de>

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] net: pse-pd: spurious error event in pse_isr() on -ENODEV
  during unregister

--

> diff --git a/drivers/net/pse-pd/pse_core.c b/drivers/net/pse-pd/pse_core.c
> --- a/drivers/net/pse-pd/pse_core.c
> +++ b/drivers/net/pse-pd/pse_core.c
> @@ -612,6 +612,13 @@ static int _pse_pi_delivery_power_sw_pw_ctrl(struct pse_controller_dev *pcdev,
>  	struct pse_pi *pi = &pcdev->pi[id];
>  	int ret, pw_req;
>  
> +	/* pse_isr(), a priority change and the retry after a disable all
> +	 * power a PI through here, so stop them here once unregistering
> +	 * has started.
> +	 */
> +	if (pcdev->unregistering)
> +		return -ENODEV;
> +
>  	if (!ops->pi_get_pw_req) {
>  		/* No power allocation management */
>  		ret = ops->pi_enable(pcdev, id);

[Severity: Medium]
pse_isr() can report a false power control error during unregister.

Say the threaded pse_isr() is already blocked on pcdev->lock when
pse_controller_unregister() sets pcdev->unregistering and drops the
lock. It then takes the lock while disable_irq() is still waiting for
it to finish.

For a classification event on a PI with admin_state_enabled set,
pse_set_config_isr() calls _pse_pi_delivery_power_sw_pw_ctrl(). That
now returns -ENODEV at this new check.

pse_set_config_isr() only clears -ERANGE, so -ENODEV goes back to
pse_isr(). pse_isr() treats any non-zero return as a failure and sets
ETHTOOL_PSE_EVENT_SW_PW_CONTROL_ERROR for that PI. It pushes the event
into pcdev->ntf_fifo and schedules ntf_work before cancel_work_sync()
runs.

If pse_send_ntf_worker() is already running at that point, it can
pick up the entry and send it through ethnl_pse_send_ntf(). Userspace
then sees a power control error for a PI that did not fail; the
controller is only going away.

This is not a memory safety problem, since disable_irq() orders the
queueing before the drain, but the event is misleading.

Should pse_set_config_isr() filter the -ENODEV from the unregistering
check the same way it filters -ERANGE? Or would you rather have
pse_isr() skip the PIs once pcdev->unregistering is set?

-- 
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261103220217.1131971-1-github%40szelinsky.de

  parent reply	other threads:[~2026-11-05 10:08 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-03 22:02 [PATCH net v3 00/14] net: pse-pd: assorted lifetime and error-path fixes Carlo Szelinsky
2026-11-03 22:02 ` [PATCH net v3 01/14] net: pse-pd: size the notification kfifo after defaulting nr_lines Carlo Szelinsky
2026-11-03 22:02 ` [PATCH net v3 02/14] net: pse-pd: remove dead pi_get_admin_state() checks Carlo Szelinsky
2026-11-04 15:19   ` Kory Maincent
2026-11-03 22:02 ` [PATCH net v3 03/14] net: pse-pd: fix module refcount leak in pse_control_get_internal() Carlo Szelinsky
2026-11-03 22:02 ` [PATCH net v3 04/14] net: pse-pd: do not keep a failed IRQ in pcdev->irq Carlo Szelinsky
2026-11-03 22:02 ` [PATCH net v3 05/14] net: pse-pd: do not reach a freed PHY from the notification worker Carlo Szelinsky
2026-11-04 15:19   ` Kory Maincent
2026-11-05 10:08   ` netdev-bot+sashiko
2026-11-05 18:01     ` Carlo Szelinsky
2026-11-03 22:02 ` [PATCH net v3 06/14] net: pse-pd: check the PI state under the lock when setting a power limit Carlo Szelinsky
2026-11-05 10:08   ` netdev-bot+sashiko
2026-11-05 18:01     ` Carlo Szelinsky
2026-11-03 22:02 ` [PATCH net v3 07/14] net: pse-pd: do not tie a shared power domain to its creator's devres Carlo Szelinsky
2026-11-04 15:19   ` Kory Maincent
2026-11-03 22:02 ` [PATCH net v3 08/14] net: pse-pd: stop async event sources before freeing PI data in unregister Carlo Szelinsky
2026-11-04 15:19   ` Kory Maincent
2026-11-05 10:08   ` netdev-bot+sashiko [this message]
2026-11-05 18:01     ` Carlo Szelinsky
2026-11-03 22:02 ` [PATCH net v3 09/14] net: pse-pd: unregister from the controller list before freeing PI data Carlo Szelinsky
2026-11-03 22:02 ` [PATCH net v3 10/14] net: pse-pd: keep the PI data until the PI regulators are gone Carlo Szelinsky
2026-11-04 15:19   ` Kory Maincent
2026-11-05 10:08   ` netdev-bot+sashiko
2026-11-05 18:02     ` Carlo Szelinsky
2026-11-03 22:02 ` [PATCH net v3 11/14] net: pse-pd: free the notification kfifo when registration fails Carlo Szelinsky
2026-11-04 15:19   ` Kory Maincent
2026-11-03 22:02 ` [PATCH net v3 12/14] net: pse-pd: use each PI's own supply handle for the power budget Carlo Szelinsky
2026-11-04 15:19   ` Kory Maincent
2026-11-03 22:02 ` [PATCH net v3 13/14] net: pse-pd: pd692x0: release the manager power budget through devres Carlo Szelinsky
2026-11-03 22:02 ` [PATCH net v3 14/14] net: pse-pd: pd692x0: defer probe while a manager supply is unresolved Carlo Szelinsky
2026-11-04 15:19 ` [PATCH net v3 00/14] net: pse-pd: assorted lifetime and error-path fixes Kory Maincent
2026-11-04 18:44   ` Carlo Szelinsky

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=179387331572.488856.14138423432886028016@kernel.org \
    --to=netdev-bot+sashiko@kernel.org \
    --cc=andrew+netdev@lunn.ch \
    --cc=broonie@kernel.org \
    --cc=davem@davemloft.net \
    --cc=edumazet@kernel.org \
    --cc=github@szelinsky.de \
    --cc=horms@kernel.org \
    --cc=kory.maincent@bootlin.com \
    --cc=kuba@kernel.org \
    --cc=kyle.swenson@est.tech \
    --cc=lgirdwood@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maxime.chevallier@bootlin.com \
    --cc=netdev@vger.kernel.org \
    --cc=o.rempel@pengutronix.de \
    --cc=pabeni@redhat.com \
    --cc=ross@r-sc.ca \
    /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