Re: [PATCH net-next 1/3] net: macb: Make sure clk_init_data is fully initialized
| Newsgroups | org.kernel.vger.linux-clk,org.infradead.lists.linux-amlogic |
|---|---|
| Message-ID | <[email protected]> |
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 <[email protected]> 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/[email protected]?part=1