]> 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)
commit487f6bc5edd811076f02efb3e5ff521fc46438de
tree053272b5cf133ddfdff5167a8b951b1c1c5cdb90
parent297a378d84daf0a7651b9f396f2837e18bb89f5c
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