ice: Check for null pointer dereference when setting rings

Without this check rebuild vsi can lead to kernel panic.

Signed-off-by: Michal Swiatkowski <michal.swiatkowski@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:
Michal Swiatkowski 2019-10-09 07:09:47 -07:00 коммит произвёл Jeff Kirsher
Родитель 4e56802e0e
Коммит eb0ee8abfe
1 изменённых файлов: 14 добавлений и 4 удалений

Просмотреть файл

@ -4303,8 +4303,13 @@ int ice_vsi_setup_tx_rings(struct ice_vsi *vsi)
}
ice_for_each_txq(vsi, i) {
vsi->tx_rings[i]->netdev = vsi->netdev;
err = ice_setup_tx_ring(vsi->tx_rings[i]);
struct ice_ring *ring = vsi->tx_rings[i];
if (!ring)
return -EINVAL;
ring->netdev = vsi->netdev;
err = ice_setup_tx_ring(ring);
if (err)
break;
}
@ -4329,8 +4334,13 @@ int ice_vsi_setup_rx_rings(struct ice_vsi *vsi)
}
ice_for_each_rxq(vsi, i) {
vsi->rx_rings[i]->netdev = vsi->netdev;
err = ice_setup_rx_ring(vsi->rx_rings[i]);
struct ice_ring *ring = vsi->rx_rings[i];
if (!ring)
return -EINVAL;
ring->netdev = vsi->netdev;
err = ice_setup_rx_ring(ring);
if (err)
break;
}