All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Geert Uytterhoeven" <geert+renesas@glider.be>
Cc: linux-clk@vger.kernel.org, linux-amlogic@lists.infradead.org,
	neil.armstrong@linaro.org
Subject: Re: [PATCH net-next 1/3] net: macb: Make sure clk_init_data is fully initialized
Date: Sat, 22 Aug 2026 10:08:03 +0000	[thread overview]
Message-ID: <20260822100804.3E9961F000E9@smtp.kernel.org> (raw)
In-Reply-To: <00772e2fb1f8433a5d6c47dbd28cb4149495e1ab.1787240118.git.geert+renesas@glider.be>

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

Pre-existing issues:
- [High] The TX error recovery task modifies TX ring pointers and state without holding `queue->tx_ptr_lock`, racing with `macb_start_xmit`.
--

--- Patch [1]: [PATCH net-next 1/3] net: macb: Make sure clk_init_data is fully initialized ---
commit 72f05b5fbec22828f860396d626f5a6bbaacd336
Author: Geert Uytterhoeven <geert+renesas@glider.be>

net: macb: Make sure clk_init_data is fully initialized

This commit initializes the clk_init_data structure to prevent issues with
uninitialized mutually-exclusive members when stack initialization patterns
are enabled.

> diff --git a/drivers/net/ethernet/cadence/macb_main.c b/drivers/net/ethernet/cadence/macb_main.c
> index 1476bce77f34d..319e43098f57e 100644
> --- a/drivers/net/ethernet/cadence/macb_main.c
> +++ b/drivers/net/ethernet/cadence/macb_main.c

[ ... ]

[Severity: High]
This isn't a bug introduced by this patch, but I noticed a pre-existing data
race between macb_tx_error_task() and macb_start_xmit() in this file.

Does macb_tx_error_task() race with macb_start_xmit() by modifying TX ring
pointers without holding queue->tx_ptr_lock?

In macb_tx_error_task(), the ring pointers are reset without a lock:

    queue->tx_head = 0;
    queue->tx_tail = 0;

Concurrently, macb_start_xmit() acquires the lock and updates tx_head:

    spin_lock_irqsave(&queue->tx_ptr_lock, flags);

Since netif_tx_stop_all_queues() only marks the queue as stopped but does not
wait for an already-executing ndo_start_xmit() to finish, could this race
corrupt the software TX ring pointers? 

This might lead to out-of-bounds DMA or use-after-free when the
desynchronized ring is subsequently processed after a transmission error.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/cover.1787240118.git.geert+renesas@glider.be?part=1

WARNING: multiple messages have this Message-ID (diff)
From: sashiko-bot@kernel.org
To: "Geert Uytterhoeven" <geert+renesas@glider.be>
Cc: linux-clk@vger.kernel.org, linux-amlogic@lists.infradead.org,
	neil.armstrong@linaro.org
Subject: Re: [PATCH net-next 1/3] net: macb: Make sure clk_init_data is fully initialized
Date: Sat, 22 Aug 2026 10:08:03 +0000	[thread overview]
Message-ID: <20260822100804.3E9961F000E9@smtp.kernel.org> (raw)
In-Reply-To: <00772e2fb1f8433a5d6c47dbd28cb4149495e1ab.1787240118.git.geert+renesas@glider.be>

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

Pre-existing issues:
- [High] The TX error recovery task modifies TX ring pointers and state without holding `queue->tx_ptr_lock`, racing with `macb_start_xmit`.
--

--- Patch [1]: [PATCH net-next 1/3] net: macb: Make sure clk_init_data is fully initialized ---
commit 72f05b5fbec22828f860396d626f5a6bbaacd336
Author: Geert Uytterhoeven <geert+renesas@glider.be>

net: macb: Make sure clk_init_data is fully initialized

This commit initializes the clk_init_data structure to prevent issues with
uninitialized mutually-exclusive members when stack initialization patterns
are enabled.

> diff --git a/drivers/net/ethernet/cadence/macb_main.c b/drivers/net/ethernet/cadence/macb_main.c
> index 1476bce77f34d..319e43098f57e 100644
> --- a/drivers/net/ethernet/cadence/macb_main.c
> +++ b/drivers/net/ethernet/cadence/macb_main.c

[ ... ]

[Severity: High]
This isn't a bug introduced by this patch, but I noticed a pre-existing data
race between macb_tx_error_task() and macb_start_xmit() in this file.

Does macb_tx_error_task() race with macb_start_xmit() by modifying TX ring
pointers without holding queue->tx_ptr_lock?

In macb_tx_error_task(), the ring pointers are reset without a lock:

    queue->tx_head = 0;
    queue->tx_tail = 0;

Concurrently, macb_start_xmit() acquires the lock and updates tx_head:

    spin_lock_irqsave(&queue->tx_ptr_lock, flags);

Since netif_tx_stop_all_queues() only marks the queue as stopped but does not
wait for an already-executing ndo_start_xmit() to finish, could this race
corrupt the software TX ring pointers? 

This might lead to out-of-bounds DMA or use-after-free when the
desynchronized ring is subsequently processed after a transmission error.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/cover.1787240118.git.geert+renesas@glider.be?part=1

_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic

  reply	other threads:[~2026-08-22 10:08 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-21 10:07 [PATCH net-next 0/3] net: Make sure clk_init_data is fully initialized Geert Uytterhoeven
2026-08-21 10:07 ` Geert Uytterhoeven
2026-08-21 10:07 ` [PATCH net-next 1/3] net: macb: " Geert Uytterhoeven
2026-08-21 10:07   ` Geert Uytterhoeven
2026-08-22 10:08   ` sashiko-bot [this message]
2026-08-22 10:08     ` sashiko-bot
2026-08-21 10:07 ` [PATCH net-next 2/3] net: mdio: mux-meson-g12a: " Geert Uytterhoeven
2026-08-21 10:07   ` Geert Uytterhoeven
2026-08-22 10:08   ` sashiko-bot
2026-08-22 10:08     ` sashiko-bot
2026-08-21 10:07 ` [PATCH net-next 3/3] net: phy: air_en8811h: " Geert Uytterhoeven
2026-08-21 10:07   ` Geert Uytterhoeven
2026-08-22 10:08   ` sashiko-bot
2026-08-22 10:08     ` sashiko-bot
2026-08-22 19:44 ` [PATCH net-next 0/3] net: " Jakub Kicinski
2026-08-22 19:44   ` Jakub Kicinski

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=20260822100804.3E9961F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=geert+renesas@glider.be \
    --cc=linux-amlogic@lists.infradead.org \
    --cc=linux-clk@vger.kernel.org \
    --cc=neil.armstrong@linaro.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.