]> git.ipfire.org Git - thirdparty/kernel/stable.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)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 17 Oct 2024 13:11:07 +0000 (15:11 +0200)
commite09deb71fb91d53356b6d24f91b233041e6acc50
tree7781a12b3ff2739a1851a1df8b9c232ed44dccc0
parent0493a5d80b4b4a31fdc863eca8b00e92718c22e7
net: axienet: Be more careful about updating tx_bd_tail

[ Upstream commit f0cf4000f5867ec4325d19d32bd83cf583065667 ]

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>
Stable-dep-of: 5a6caa2cfabb ("net: xilinx: axienet: Fix packet counting")
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/ethernet/xilinx/xilinx_axienet_main.c