Commit eb0ee8ab authored by Michal Swiatkowski's avatar Michal Swiatkowski Committed by Jeff Kirsher

ice: Check for null pointer dereference when setting rings

Without this check rebuild vsi can lead to kernel panic.
Signed-off-by: default avatarMichal Swiatkowski <michal.swiatkowski@intel.com>
Tested-by: default avatarAndrew Bowers <andrewx.bowers@intel.com>
Signed-off-by: default avatarJeff Kirsher <jeffrey.t.kirsher@intel.com>
parent 4e56802e
...@@ -4303,8 +4303,13 @@ int ice_vsi_setup_tx_rings(struct ice_vsi *vsi) ...@@ -4303,8 +4303,13 @@ int ice_vsi_setup_tx_rings(struct ice_vsi *vsi)
} }
ice_for_each_txq(vsi, i) { ice_for_each_txq(vsi, i) {
vsi->tx_rings[i]->netdev = vsi->netdev; struct ice_ring *ring = vsi->tx_rings[i];
err = ice_setup_tx_ring(vsi->tx_rings[i]);
if (!ring)
return -EINVAL;
ring->netdev = vsi->netdev;
err = ice_setup_tx_ring(ring);
if (err) if (err)
break; break;
} }
...@@ -4329,8 +4334,13 @@ int ice_vsi_setup_rx_rings(struct ice_vsi *vsi) ...@@ -4329,8 +4334,13 @@ int ice_vsi_setup_rx_rings(struct ice_vsi *vsi)
} }
ice_for_each_rxq(vsi, i) { ice_for_each_rxq(vsi, i) {
vsi->rx_rings[i]->netdev = vsi->netdev; struct ice_ring *ring = vsi->rx_rings[i];
err = ice_setup_rx_ring(vsi->rx_rings[i]);
if (!ring)
return -EINVAL;
ring->netdev = vsi->netdev;
err = ice_setup_rx_ring(ring);
if (err) if (err)
break; break;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment