Skip to content

Commit 86e3f78

Browse files
mfijalkoborkmann
authored andcommitted
ice: xsk: Avoid potential dead AF_XDP Tx processing
Commit 9610bd9 ("ice: optimize XDP_TX workloads") introduced @next_dd and @next_rs to ice_tx_ring struct. Currently, their state is not restored in ice_clean_tx_ring(), which was not causing any troubles as the XDP rings are gone after we're done with XDP prog on interface. For upcoming usage of mentioned fields in AF_XDP, this might expose us to a potential dead Tx side. Scenario would look like following (based on xdpsock): - two xdpsock instances are spawned in Tx mode - one of them is killed - XDP prog is kept on interface due to the other xdpsock still running * this means that XDP rings stayed in place - xdpsock is launched again on same queue id that was terminated on - @next_dd and @next_rs setting is bogus, therefore transmit side is broken To protect us from the above, restore the initial @next_rs and @next_dd values when cleaning the Tx ring. Signed-off-by: Maciej Fijalkowski <[email protected]> Signed-off-by: Daniel Borkmann <[email protected]> Reviewed-by: Alexander Lobakin <[email protected]> Acked-by: Magnus Karlsson <[email protected]> Link: https://lore.kernel.org/bpf/[email protected]
1 parent d1bc532 commit 86e3f78

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

drivers/net/ethernet/intel/ice/ice_txrx.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,8 @@ void ice_clean_tx_ring(struct ice_tx_ring *tx_ring)
173173

174174
tx_ring->next_to_use = 0;
175175
tx_ring->next_to_clean = 0;
176+
tx_ring->next_dd = ICE_RING_QUARTER(tx_ring) - 1;
177+
tx_ring->next_rs = ICE_RING_QUARTER(tx_ring) - 1;
176178

177179
if (!tx_ring->netdev)
178180
return;

0 commit comments

Comments
 (0)