ice: protect ring accesses with WRITE_ONCE
The READ_ONCE macro is used when reading rings prior to accessing the statistics pointer. The corresponding WRITE_ONCE usage when allocating and freeing the rings to ensure protected access was not in place. Introduce this. Signed-off-by: Ciara Loftus <ciara.loftus@intel.com> Tested-by: Andrew Bowers <andrewx.bowers@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
This commit is contained in:
parent
d59e267912
commit
b1d95cc239
drivers/net/ethernet/intel/ice
@ -1194,7 +1194,7 @@ static void ice_vsi_clear_rings(struct ice_vsi *vsi)
|
||||
for (i = 0; i < vsi->alloc_txq; i++) {
|
||||
if (vsi->tx_rings[i]) {
|
||||
kfree_rcu(vsi->tx_rings[i], rcu);
|
||||
vsi->tx_rings[i] = NULL;
|
||||
WRITE_ONCE(vsi->tx_rings[i], NULL);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1202,7 +1202,7 @@ static void ice_vsi_clear_rings(struct ice_vsi *vsi)
|
||||
for (i = 0; i < vsi->alloc_rxq; i++) {
|
||||
if (vsi->rx_rings[i]) {
|
||||
kfree_rcu(vsi->rx_rings[i], rcu);
|
||||
vsi->rx_rings[i] = NULL;
|
||||
WRITE_ONCE(vsi->rx_rings[i], NULL);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1235,7 +1235,7 @@ static int ice_vsi_alloc_rings(struct ice_vsi *vsi)
|
||||
ring->vsi = vsi;
|
||||
ring->dev = dev;
|
||||
ring->count = vsi->num_tx_desc;
|
||||
vsi->tx_rings[i] = ring;
|
||||
WRITE_ONCE(vsi->tx_rings[i], ring);
|
||||
}
|
||||
|
||||
/* Allocate Rx rings */
|
||||
@ -1254,7 +1254,7 @@ static int ice_vsi_alloc_rings(struct ice_vsi *vsi)
|
||||
ring->netdev = vsi->netdev;
|
||||
ring->dev = dev;
|
||||
ring->count = vsi->num_rx_desc;
|
||||
vsi->rx_rings[i] = ring;
|
||||
WRITE_ONCE(vsi->rx_rings[i], ring);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
@ -1702,7 +1702,7 @@ static int ice_xdp_alloc_setup_rings(struct ice_vsi *vsi)
|
||||
xdp_ring->netdev = NULL;
|
||||
xdp_ring->dev = dev;
|
||||
xdp_ring->count = vsi->num_tx_desc;
|
||||
vsi->xdp_rings[i] = xdp_ring;
|
||||
WRITE_ONCE(vsi->xdp_rings[i], xdp_ring);
|
||||
if (ice_setup_tx_ring(xdp_ring))
|
||||
goto free_xdp_rings;
|
||||
ice_set_ring_xdp(xdp_ring);
|
||||
|
Loading…
Reference in New Issue
Block a user