Skip to content

Commit 8d5f4b0

Browse files
bernd-edlingerdavem330
authored andcommitted
stmmac: Don't access tx_q->dirty_tx before netif_tx_lock
This is the possible reason for different hard to reproduce problems on my ARMv7-SMP test system. The symptoms are in recent kernels imprecise external aborts, and in older kernels various kinds of network stalls and unexpected page allocation failures. My testing indicates that the trouble started between v4.5 and v4.6 and prevails up to v4.14. Using the dirty_tx before acquiring the spin lock is clearly wrong and was first introduced with v4.6. Fixes: e3ad57c ("stmmac: review RX/TX ring management") Signed-off-by: Bernd Edlinger <bernd.edlinger@hotmail.de> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 864e2a1 commit 8d5f4b0

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

drivers/net/ethernet/stmicro/stmmac/stmmac_main.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1799,12 +1799,13 @@ static void stmmac_tx_clean(struct stmmac_priv *priv, u32 queue)
17991799
{
18001800
struct stmmac_tx_queue *tx_q = &priv->tx_queue[queue];
18011801
unsigned int bytes_compl = 0, pkts_compl = 0;
1802-
unsigned int entry = tx_q->dirty_tx;
1802+
unsigned int entry;
18031803

18041804
netif_tx_lock(priv->dev);
18051805

18061806
priv->xstats.tx_clean++;
18071807

1808+
entry = tx_q->dirty_tx;
18081809
while (entry != tx_q->cur_tx) {
18091810
struct sk_buff *skb = tx_q->tx_skbuff[entry];
18101811
struct dma_desc *p;

0 commit comments

Comments
 (0)