From: sashiko-bot@kernel.org
To: "Arthur Crepin Leblond" <arthur@marmottus.net>
Cc: robh@kernel.org, conor+dt@kernel.org, devicetree@vger.kernel.org
Subject: Re: [PATCH net-next v8 3/3] w5100: detect carrier state using link status bit and optional interrupt
Date: Wed, 16 Sep 2026 08:07:54 +0000 [thread overview]
Message-ID: <20260916080754.A4FED1F0089A@smtp.kernel.org> (raw)
In-Reply-To: <20260915-wiznet-link-gpio-v8-3-d173622474cc@marmottus.net>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] net: w5100: teardown race condition due to inverted cancel/free order
--
commit a7c6f85022e2b47daf620a6b97b050a3490bd3ef
Author: Arthur Crepin Leblond <arthur@marmottus.net>
w5100: detect carrier state using link status bit and optional interrupt
This commit adds carrier state detection using the Link Status bit on the
w5500. It introduces an optional interrupt for link status changes and ensures
the netdev is registered last during probe.
> diff --git a/drivers/net/ethernet/wiznet/w5100.c b/drivers/net/ethernet/wiznet/w5100.c
> --- a/drivers/net/ethernet/wiznet/w5100.c
> +++ b/drivers/net/ethernet/wiznet/w5100.c
[ ... ]
> @@ -820,14 +953,22 @@ void w5100_remove(struct device *dev)
> struct net_device *ndev = dev_get_drvdata(dev);
> struct w5100_priv *priv = netdev_priv(ndev);
>
> - w5100_hw_reset(priv);
> + unregister_netdev(ndev);
> +
> + cancel_work_sync(&priv->rx_work);
> + cancel_work_sync(&priv->tx_work);
> + cancel_work_sync(&priv->setrx_work);
> + cancel_work_sync(&priv->restart_work);
> +
> + if (priv->link_irq > 0)
> + free_irq(priv->link_irq, ndev);
> +
> free_irq(priv->irq, ndev);
[Severity: High]
Does this code introduce a teardown race by canceling the work queues before
freeing the interrupts?
If the threaded interrupt handler (w5100_interrupt) is running concurrently
during w5100_remove(), it could queue a new rx_work or tx_work immediately
after cancel_work_sync() returns.
Later in the teardown, destroy_workqueue() drains and forcibly executes all
pending works. Since w5100_hw_reset() is called prior to destroy_workqueue(),
could these newly queued works execute against a reset and uninitialized
hardware state, potentially causing I/O corruption or kernel crashes?
Should free_irq() be called before cancel_work_sync() to guarantee the
interrupt handler has completed and no new works will be queued?
> + w5100_hw_reset(priv);
>
> - flush_work(&priv->setrx_work);
> - flush_work(&priv->restart_work);
> destroy_workqueue(priv->xfer_wq);
> + mutex_destroy(&priv->link_lock);
>
> - unregister_netdev(ndev);
> free_netdev(ndev);
> }
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260915-wiznet-link-gpio-v8-0-d173622474cc@marmottus.net?part=3
next prev parent reply other threads:[~2026-09-16 8:07 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-15 8:06 [PATCH net-next v8 0/3] w5100: restore GPIO-based link detection Arthur Crepin Leblond
2026-09-15 8:06 ` [PATCH net-next v8 1/3] dt-bindings: net: wiznet,w5100: convert to DT schema Arthur Crepin Leblond
2026-09-17 20:08 ` netdev-bot+sashiko
2026-09-18 7:03 ` Arthur Crepin Leblond
2026-09-15 8:06 ` [PATCH net-next v8 2/3] dt-bindings: net: wiznet,w5100: add link status interrupt Arthur Crepin Leblond
2026-09-17 10:04 ` Krzysztof Kozlowski
2026-09-17 12:02 ` Arthur Crepin Leblond
2026-09-17 20:08 ` netdev-bot+sashiko
2026-09-18 7:17 ` Arthur Crepin Leblond
2026-09-15 8:06 ` [PATCH net-next v8 3/3] w5100: detect carrier state using link status bit and optional interrupt Arthur Crepin Leblond
2026-09-16 8:07 ` sashiko-bot [this message]
2026-09-16 8:26 ` Arthur Crepin Leblond
2026-09-17 20:08 ` netdev-bot+sashiko
2026-09-18 12:18 ` 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=20260916080754.A4FED1F0089A@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