mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-07 03:15:31 +09:00
ice: synchronize_rcu() when terminating rings
[ Upstream commitf9124c68f0] Unfortunately, the ice driver doesn't respect the RCU critical section that XSK wakeup is surrounded with. To fix this, add synchronize_rcu() calls to paths that destroy resources that might be in use. This was addressed in other AF_XDP ZC enabled drivers, for reference see for example commitb3873a5be7("net/i40e: Fix concurrency issues between config flow and XSK") Fixes:efc2214b60("ice: Add support for XDP") Fixes:2d4238f556("ice: Add support for AF_XDP") Signed-off-by: Maciej Fijalkowski <maciej.fijalkowski@intel.com> Tested-by: Shwetha Nagaraju <shwetha.nagaraju@intel.com> Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
070aa68f8f
commit
840cbbdc8b
@@ -552,7 +552,7 @@ static inline struct ice_pf *ice_netdev_to_pf(struct net_device *netdev)
|
||||
|
||||
static inline bool ice_is_xdp_ena_vsi(struct ice_vsi *vsi)
|
||||
{
|
||||
return !!vsi->xdp_prog;
|
||||
return !!READ_ONCE(vsi->xdp_prog);
|
||||
}
|
||||
|
||||
static inline void ice_set_ring_xdp(struct ice_ring *ring)
|
||||
|
||||
@@ -2612,8 +2612,10 @@ free_qmap:
|
||||
|
||||
for (i = 0; i < vsi->num_xdp_txq; i++)
|
||||
if (vsi->xdp_rings[i]) {
|
||||
if (vsi->xdp_rings[i]->desc)
|
||||
if (vsi->xdp_rings[i]->desc) {
|
||||
synchronize_rcu();
|
||||
ice_free_tx_ring(vsi->xdp_rings[i]);
|
||||
}
|
||||
kfree_rcu(vsi->xdp_rings[i], rcu);
|
||||
vsi->xdp_rings[i] = NULL;
|
||||
}
|
||||
|
||||
@@ -36,8 +36,10 @@ static void ice_qp_reset_stats(struct ice_vsi *vsi, u16 q_idx)
|
||||
static void ice_qp_clean_rings(struct ice_vsi *vsi, u16 q_idx)
|
||||
{
|
||||
ice_clean_tx_ring(vsi->tx_rings[q_idx]);
|
||||
if (ice_is_xdp_ena_vsi(vsi))
|
||||
if (ice_is_xdp_ena_vsi(vsi)) {
|
||||
synchronize_rcu();
|
||||
ice_clean_tx_ring(vsi->xdp_rings[q_idx]);
|
||||
}
|
||||
ice_clean_rx_ring(vsi->rx_rings[q_idx]);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user