All of lore.kernel.org
 help / color / mirror / Atom feed
From: Arthur Crepin Leblond <arthur@marmottus.net>
To: sashiko-reviews@lists.linux.dev
Cc: devicetree@vger.kernel.org, robh@kernel.org, conor+dt@kernel.org
Subject: Re: [PATCH net-next v10 3/3] w5100: detect carrier state using link status bit and optional interrupt
Date: Tue, 22 Sep 2026 16:02:39 +0200	[thread overview]
Message-ID: <20260922140239.GA85030@marmottus.net> (raw)
In-Reply-To: <20260922105316.82F431F000FF@smtp.kernel.org>

On Tue, Sep 22, 2026 at 10:53:15AM +0000, sashiko-bot@kernel.org wrote:
>Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
>- [High] net: w5100: race in w5100_suspend due to incorrect detach ordering and missing work flushes
>--
>
>commit 4b50b6b7047dc53f16eedfdba4f4a537ef54c0fd
>Author: Arthur Crepin Leblond <arthur@marmottus.net>
>
>w5100: detect carrier state using link status bit and optional interrupt
>
>This commit adds support for detecting the carrier state on the w5500 Ethernet
>controller using the Link Status bit and an optional interrupt. It also
>refactors the bring-up and teardown operations, including changes to when
>net device registration and work queue cancellations occur.
>
>> 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
>[ ... ]
>> @@ -839,9 +997,20 @@ static int w5100_suspend(struct device *dev)
>>  	struct w5100_priv *priv = netdev_priv(ndev);
>>
>>  	if (netif_running(ndev)) {
>> -		netif_carrier_off(ndev);
>> +		disable_irq(priv->irq);
>> +		if (priv->link_irq > 0)
>> +			disable_irq(priv->link_irq);
>> +
>> +		cancel_work_sync(&priv->restart_work);
>> +
>>  		netif_device_detach(ndev);
>
>[Severity: High]
>Does this code leave a race condition in w5100_suspend() due to the detach
>ordering?
>
>If a TX timeout occurs between cancel_work_sync(&priv->restart_work) and
>netif_device_detach(), wouldn't restart_work be re-scheduled because the
>netdev watchdog is still active?
>
>Also, rx_work, tx_work, setrx_work, and napi do not appear to be flushed or
>disabled in w5100_suspend(), unlike in w5100_stop(). Could this allow them
>to execute concurrently with or after w5100_hw_close(priv) and access
>suspended SPI hardware?
>
>>
>> +		if (priv->link_irq > 0) {
>> +			mutex_lock(&priv->link_lock);
>> +			netif_carrier_off(ndev);
>> +			mutex_unlock(&priv->link_lock);
>> +		}
>> +
>>  		w5100_hw_close(priv);
>>  	}
>>  	return 0;
>
>--
>Sashiko AI review · https://sashiko.dev/#/patchset/20260921-wiznet-link-gpio-v10-0-5874a7a147a2@marmottus.net?part=3

Probably very low chances to happen but YES, w5100_suspend() could
cleanup the same way as w5100_stop()

Arthur

  reply	other threads:[~2026-09-22 14:02 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-21 10:52 [PATCH net-next v10 0/3] w5100: restore GPIO-based link detection Arthur Crepin Leblond
2026-09-21 10:52 ` [PATCH net-next v10 1/3] dt-bindings: net: wiznet,w5100: convert to DT schema Arthur Crepin Leblond
2026-09-24  1:55   ` netdev-bot+sashiko
2026-09-24  7:12     ` Arthur Crepin Leblond
2026-09-21 10:52 ` [PATCH net-next v10 2/3] dt-bindings: net: wiznet,w5100: add link status interrupt Arthur Crepin Leblond
2026-09-24  1:55   ` netdev-bot+sashiko
2026-09-24  7:14     ` Arthur Crepin Leblond
2026-09-21 10:52 ` [PATCH net-next v10 3/3] w5100: detect carrier state using link status bit and optional interrupt Arthur Crepin Leblond
2026-09-21 15:31   ` Arthur Crepin Leblond
2026-09-22 10:53   ` sashiko-bot
2026-09-22 14:02     ` Arthur Crepin Leblond [this message]
2026-09-24  1:55   ` netdev-bot+sashiko
2026-09-24  8:26     ` 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=20260922140239.GA85030@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.