Re: [PATCH net] net: macb: take bp->lock around NCR read-modify-writes

From: Nicolai Buchwitz

Date: Fri Sep 18 2026 - 16:31:12 EST


Hi Théo

On 18.9.2026 21:59, Théo Lebrun wrote:
NCR is read-modify-written from many contexts:

- macb_mac_link_down() clears RE|TE,
- macb_mac_link_up() sets RE|TE|PTPUNI,
- macb_hresp_error_task() clears then re-sets RE|TE,
- macb_start_xmit() / macb_tx_restart() / macb_tx_error_task() set
TSTART (already under bp->lock),
- macb_interrupt() might toggle RE (also under bp->lock).

The first three risk concurrent RMW with anyone from the list as they
don't grab bp->lock.

There is a fourth, in at91ether_interrupt():

if (intstatus & MACB_BIT(RXUBR)) {
ctl = macb_readl(bp, NCR);
macb_writel(bp, NCR, ctl & ~MACB_BIT(RE));
wmb();
macb_writel(bp, NCR, ctl | MACB_BIT(RE));
}

I guess you have skipped this as the emac variants using this are not SMP?

[...]

Reviewed-by: Nicolai Buchwitz <nb@xxxxxxxxxxx>

Regards
Nicolai