]> git.baikalelectronics.ru Git - kernel.git/commit
net: axienet: Be more careful about updating tx_bd_tail
authorRobert Hancock <robert.hancock@calian.com>
Thu, 12 May 2022 17:18:52 +0000 (11:18 -0600)
committerDavid S. Miller <davem@davemloft.net>
Fri, 13 May 2022 11:22:11 +0000 (12:22 +0100)
commit12b1ce8d794a65279ecb14f9f681cd621b91bfca
treec2c09a341e6e456612642c389edc734114d81eda
parent5c8561877048838c7820730056bddf9da8473c7b
net: axienet: Be more careful about updating tx_bd_tail

The axienet_start_xmit function was updating the tx_bd_tail variable
multiple times, with potential rollbacks on error or invalid
intermediate positions, even though this variable is also used in the
TX completion path. Use READ_ONCE where this variable is read and
WRITE_ONCE where it is written to make this update more atomic, and
move the write before the MMIO write to start the transfer, so it is
protected by that implicit write barrier.

Signed-off-by: Robert Hancock <robert.hancock@calian.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/xilinx/xilinx_axienet_main.c