From: Arthur Crepin Leblond <arthur@marmottus.net>
To: sashiko-reviews@lists.linux.dev
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 10:26:28 +0200 [thread overview]
Message-ID: <20260916082628.GA100127@marmottus.net> (raw)
In-Reply-To: <20260916080754.A4FED1F0089A@smtp.kernel.org>
On Wed, Sep 16, 2026 at 08:07:54AM +0000, sashiko-bot@kernel.org wrote:
>> @@ -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?
Good catch and seems like it's the only issue you found! Let's see
what Clashiko will find. I'll fix that in the next patch.
Arthur
next prev parent reply other threads:[~2026-09-16 8:45 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
2026-09-16 8:26 ` Arthur Crepin Leblond [this message]
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=20260916082628.GA100127@marmottus.net \
--to=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