From: sashiko-bot@kernel.org
To: "Arthur Crepin Leblond" <arthur@marmottus.net>
Cc: conor+dt@kernel.org, devicetree@vger.kernel.org, robh@kernel.org
Subject: Re: [PATCH net-next v6 3/3] w5100: detect carrier state using link status bit and optional interrupt
Date: Tue, 01 Sep 2026 12:54:34 +0000 [thread overview]
Message-ID: <20260901125435.3B17F1F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260831-wiznet-link-gpio-v6-3-abee6c5c966e@marmottus.net>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] Teardown order and race condition in `w5100_remove`
--
commit 2d15b81e4c22951dac168989fccf463a39479cef
Author: Arthur Crepin Leblond <arthur@marmottus.net>
w5100: detect carrier state using link status bit and optional interrupt
This commit detects the link status on the w5500 using the Link Status
bit from the PHY Configuration register. It also adds an optional
interrupt wired to the LINKLED pin of the w5500 to detect link status
changes, and registers the netdev last in the probe function.
> diff --git a/drivers/net/ethernet/wiznet/w5100.c b/drivers/net/ethernet/wiznet/w5100.c
> index 53d8dc642fbd6..d91881ecd797c 100644
> --- a/drivers/net/ethernet/wiznet/w5100.c
> +++ b/drivers/net/ethernet/wiznet/w5100.c
[ ... ]
> @@ -667,6 +722,10 @@ static int w5100_stop(struct net_device *ndev)
> struct w5100_priv *priv = netdev_priv(ndev);
>
> netif_info(priv, ifdown, ndev, "shutting down\n");
> +
> + if (priv->link_irq >= 0)
> + disable_irq(priv->link_irq);
[Severity: High]
In w5100_stop() (drivers/net/ethernet/wiznet/w5100.c), can w5100_remove()
and w5100_stop() race here?
If an interface shutdown (ndo_stop) executes concurrently with w5100_remove(),
w5100_stop() could evaluate priv->link_irq >= 0 to true, get preempted, and
then call disable_irq() after w5100_remove() has already freed the interrupt
descriptor.
[ ... ]
> @@ -820,14 +902,20 @@ void w5100_remove(struct device *dev)
> struct net_device *ndev = dev_get_drvdata(dev);
> struct w5100_priv *priv = netdev_priv(ndev);
>
> + if (priv->link_irq >= 0) {
> + free_irq(priv->link_irq, ndev);
> + priv->link_irq = -ENODEV;
> + }
> +
> w5100_hw_reset(priv);
> free_irq(priv->irq, ndev);
>
> + unregister_netdev(ndev);
[Severity: High]
In w5100_remove() (drivers/net/ethernet/wiznet/w5100.c), does this expose
the driver to concurrent operations on reset hardware?
unregister_netdev() is called after w5100_hw_reset() and free_irq(), which
means the network stack might still be actively transmitting or calling into
the driver while the hardware is in a reset state.
This is a pre-existing issue, but this change exacerbates it by introducing
the link_irq race described above.
> +
> flush_work(&priv->setrx_work);
> flush_work(&priv->restart_work);
> destroy_workqueue(priv->xfer_wq);
>
> - unregister_netdev(ndev);
> free_netdev(ndev);
> }
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260831-wiznet-link-gpio-v6-0-abee6c5c966e@marmottus.net?part=3
next prev parent reply other threads:[~2026-09-01 12:54 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-31 12:53 [PATCH net-next v6 0/3] w5100: restore GPIO-based link detection Arthur Crepin Leblond
2026-08-31 12:53 ` [PATCH net-next v6 1/3] dt-bindings: net: wiznet,w5100: convert to DT schema Arthur Crepin Leblond
2026-09-03 0:56 ` [net-next,v6,1/3] " netdev-bot+sashiko
2026-08-31 12:53 ` [PATCH net-next v6 2/3] dt-bindings: net: wiznet,w5100: add link status interrupt Arthur Crepin Leblond
2026-09-01 9:58 ` Krzysztof Kozlowski
2026-09-03 0:56 ` [net-next,v6,2/3] " netdev-bot+sashiko
2026-08-31 12:53 ` [PATCH net-next v6 3/3] w5100: detect carrier state using link status bit and optional interrupt Arthur Crepin Leblond
2026-09-01 12:54 ` sashiko-bot [this message]
2026-09-03 0:56 ` [net-next,v6,3/3] " netdev-bot+sashiko
2026-09-03 13:08 ` Arthur Crepin Leblond
2026-09-03 15:10 ` Arthur Crepin Leblond
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=20260901125435.3B17F1F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=arthur@marmottus.net \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=robh@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox