Thread (4 messages) flat view 4 messages, 3 authors, 3d ago

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

From: Nicolai Buchwitz <nb@tipi-net.de>
Date: 2026-09-18 20:31:05
Also in: lkml, stable

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@tipi-net.de>

Regards
Nicolai
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help