]> git.baikalelectronics.ru Git - kernel.git/commit
net: renesas: sh_eth: Fix freeing wrong tx descriptor
authorYoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Tue, 7 Sep 2021 11:29:40 +0000 (20:29 +0900)
committerDavid S. Miller <davem@davemloft.net>
Tue, 7 Sep 2021 13:02:02 +0000 (14:02 +0100)
commitc92b84db08f6b066c504893840412b43634eb3e3
tree053272b5cf133ddfdff5167a8b951b1c1c5cdb90
parent2b33b12d2c2dd9f80f6d0df5f4177d8a6d2bc0e5
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: 28513c69e30d ("net: sh_eth: add support for Renesas SuperH Ethernet")
Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/renesas/sh_eth.c