]> 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)
commitbd0b3787b776687953c46b533c84593696a1cac1
treec2c09a341e6e456612642c389edc734114d81eda
parent9783869a6f8011f07141f790b4fd42a474c06e94
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