All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Ciprian Regus via B4 Relay"
	<devnull+ciprian.regus.analog.com@kernel.org>
Cc: conor+dt@kernel.org, devicetree@vger.kernel.org, robh@kernel.org
Subject: Re: [PATCH net-next v3 03/13] net: ethernet: oa_tc6: add OA_TC6_BROKEN_PHY quirk flag
Date: Fri, 05 Jun 2026 16:33:11 +0000	[thread overview]
Message-ID: <20260605163312.2BA371F00898@smtp.kernel.org> (raw)
In-Reply-To: <20260604-adin1140-driver-v3-3-5debdb3173c4@analog.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:

Pre-existing issues:
- [High] TOCTOU race in TX path can lead to a permanently stopped network queue.
--

commit 3d52460cfb1b1b89ef4ee5edf6fd1d68050769d6
Author: Ciprian Regus <ciprian.regus@analog.com>

net: ethernet: oa_tc6: add OA_TC6_BROKEN_PHY quirk flag

This commit adds the OA_TC6_BROKEN_PHY quirk flag to skip internal PHY
initialization and management for MAC-PHY devices with hardware issues.
Drivers can use this flag to manage the PHY themselves instead of relying
on the framework.

> diff --git a/drivers/net/ethernet/oa_tc6.c b/drivers/net/ethernet/oa_tc6.c
> index baba5aad84dfa..2a72f0c4b0095 100644
> --- a/drivers/net/ethernet/oa_tc6.c
> +++ b/drivers/net/ethernet/oa_tc6.c
> @@ -134,6 +134,7 @@ struct oa_tc6 {
>  	bool rx_buf_overflow;
>  	bool int_flag;
>  	bool prot_ctrl;
> +	enum oa_tc6_quirk_flag quirk_flags;
>  };
>  
>  enum oa_tc6_header_type {

[Severity: High]
This is a pre-existing issue and was not introduced by the patch under
review, but is there a TOCTOU race in the TX path that could lead to a
permanently stopped network queue?

If CPU1 runs oa_tc6_start_xmit() and sees tc6->waiting_tx_skb:

drivers/net/ethernet/oa_tc6.c:oa_tc6_start_xmit() {
	if (tc6->waiting_tx_skb) {
		netif_stop_queue(tc6->netdev);
		return NETDEV_TX_BUSY;
	}
}

And CPU2 concurrently runs the SPI kthread which clears the SKB and tries
to wake the queue:

drivers/net/ethernet/oa_tc6.c:oa_tc6_try_spi_transfer() {
		if (!tc6->waiting_tx_skb && netif_queue_stopped(tc6->netdev))
			netif_wake_queue(tc6->netdev);
}

Could the following sequence occur?

1. CPU1 checks tc6->waiting_tx_skb and evaluates to true.
2. CPU2 processes the skb and sets tc6->waiting_tx_skb to NULL.
3. CPU2 checks netif_queue_stopped(), which is false because CPU1 hasn't
   stopped it yet, so it skips waking the queue.
4. CPU1 calls netif_stop_queue() and returns NETDEV_TX_BUSY.

The SPI thread would then go to sleep and the network queue would remain
permanently stopped until an asynchronous event awakens the SPI thread.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260604-adin1140-driver-v3-0-5debdb3173c4@analog.com?part=3

  reply	other threads:[~2026-06-05 16:33 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-04 16:32 [PATCH net-next v3 00/13] net: Add ADIN1140 support Ciprian Regus via B4 Relay
2026-06-04 16:32 ` Ciprian Regus
2026-06-04 16:32 ` [PATCH net-next v3 01/13] dt-bindings: net: Add ADIN1140 Ciprian Regus via B4 Relay
2026-06-04 16:32   ` Ciprian Regus
2026-06-04 16:39   ` Conor Dooley
2026-06-04 16:32 ` [PATCH net-next v3 02/13] net: ethernet: oa_tc6: Handle the OA TC6 SPI protected mode Ciprian Regus via B4 Relay
2026-06-04 16:32   ` Ciprian Regus
2026-06-05 16:33   ` sashiko-bot
2026-06-04 16:32 ` [PATCH net-next v3 03/13] net: ethernet: oa_tc6: add OA_TC6_BROKEN_PHY quirk flag Ciprian Regus via B4 Relay
2026-06-04 16:32   ` Ciprian Regus
2026-06-05 16:33   ` sashiko-bot [this message]
2026-06-04 16:32 ` [PATCH net-next v3 04/13] net: ethernet: oa_tc6: Export the C45 access functions Ciprian Regus via B4 Relay
2026-06-04 16:32   ` Ciprian Regus
2026-06-05 16:33   ` sashiko-bot
2026-06-04 16:32 ` [PATCH net-next v3 05/13] net: ethernet: oa_tc6: Export standard defined registers Ciprian Regus via B4 Relay
2026-06-04 16:32   ` Ciprian Regus
2026-06-04 22:13   ` Andrew Lunn
2026-06-05 16:33   ` sashiko-bot
2026-06-04 16:32 ` [PATCH net-next v3 06/13] net: ethernet: oa_tc6: Add the OA_TC6_ prefix to standard registers Ciprian Regus via B4 Relay
2026-06-04 16:32   ` Ciprian Regus
2026-06-04 22:14   ` Andrew Lunn
2026-06-04 16:32 ` [PATCH net-next v3 07/13] net: ethernet: oa_tc6: Add read_mms/write_mms register access functions Ciprian Regus via B4 Relay
2026-06-04 16:32   ` Ciprian Regus
2026-06-04 22:19   ` Andrew Lunn
2026-06-04 22:21   ` Andrew Lunn
2026-06-04 16:32 ` [PATCH net-next v3 08/13] net: ethernet: oa_tc6: Use the read_mms/write_mms functions for C45 Ciprian Regus via B4 Relay
2026-06-04 16:32   ` Ciprian Regus
2026-06-04 22:23   ` Andrew Lunn
2026-06-04 16:32 ` [PATCH net-next v3 09/13] net: ethernet: oa_tc6: Add new register address defines Ciprian Regus via B4 Relay
2026-06-04 16:32   ` Ciprian Regus
2026-06-04 22:31   ` Andrew Lunn
2026-06-04 16:32 ` [PATCH net-next v3 10/13] net: phy: add generic helpers for direct C45 MMD access Ciprian Regus via B4 Relay
2026-06-04 16:32   ` Ciprian Regus
2026-06-04 16:32 ` [PATCH net-next v3 11/13] net: phy: microchip-t1s: use generic C45 MMD access helpers Ciprian Regus via B4 Relay
2026-06-04 16:32   ` Ciprian Regus
2026-06-04 16:32 ` [PATCH net-next v3 12/13] net: phy: Add support for the ADIN1140 PHY Ciprian Regus via B4 Relay
2026-06-04 16:32   ` Ciprian Regus
2026-06-04 16:32 ` [PATCH net-next v3 13/13] net: ethernet: adi: Add a driver for the ADIN1140 MACPHY Ciprian Regus via B4 Relay
2026-06-04 16:32   ` Ciprian Regus
2026-06-04 22:36   ` Andrew Lunn
2026-06-05 16:33   ` sashiko-bot

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=20260605163312.2BA371F00898@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=devnull+ciprian.regus.analog.com@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.