]> git.baikalelectronics.ru Git - kernel.git/commit
ice: xsk: Avoid potential dead AF_XDP Tx processing
authorMaciej Fijalkowski <maciej.fijalkowski@intel.com>
Tue, 25 Jan 2022 16:04:44 +0000 (17:04 +0100)
committerDaniel Borkmann <daniel@iogearbox.net>
Thu, 27 Jan 2022 16:25:33 +0000 (17:25 +0100)
commitbc4c960f60ebc9f6f5b8d6a2a1bfdc1e00f4d8a2
tree79c49ed2f7ad7a2f79f52921bbfb2ade1a856655
parentac8a428a46644f3b0881f095e960d89dab578287
ice: xsk: Avoid potential dead AF_XDP Tx processing

Commit b2c9f6e2cd33 ("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 <maciej.fijalkowski@intel.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Reviewed-by: Alexander Lobakin <alexandr.lobakin@intel.com>
Acked-by: Magnus Karlsson <magnus.karlsson@intel.com>
Link: https://lore.kernel.org/bpf/20220125160446.78976-7-maciej.fijalkowski@intel.com
drivers/net/ethernet/intel/ice/ice_txrx.c