Skip to content

Commit 0341d5e

Browse files
shimodaydavem330
authored andcommitted
net: renesas: sh_eth: Fix freeing wrong tx descriptor
The cur_tx counter must be incremented after TACT bit of txdesc->status was set. However, a CPU is possible to reorder instructions and/or memory accesses between cur_tx and txdesc->status. And then, if TX interrupt happened at such a timing, the sh_eth_tx_free() may free the descriptor wrongly. So, add wmb() before cur_tx++. Otherwise NETDEV WATCHDOG timeout is possible to happen. Fixes: 86a74ff ("net: sh_eth: add support for Renesas SuperH Ethernet") Signed-off-by: Yoshihiro Shimoda <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent bbef56d commit 0341d5e

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

drivers/net/ethernet/renesas/sh_eth.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2533,6 +2533,7 @@ static netdev_tx_t sh_eth_start_xmit(struct sk_buff *skb,
25332533
else
25342534
txdesc->status |= cpu_to_le32(TD_TACT);
25352535

2536+
wmb(); /* cur_tx must be incremented after TACT bit was set */
25362537
mdp->cur_tx++;
25372538

25382539
if (!(sh_eth_read(ndev, EDTRR) & mdp->cd->edtrr_trns))

0 commit comments

Comments
 (0)