ice: prevent low-core machines crashing on DCB config
Subsystems (2)
PATCH 1/1 ice: prevent low-core machines crashing on DCB config
In the case where the driver is loaded on a low-core (< 8) core system, and then a DCB config applied with the number of traffic classes greater than the number of queues defined at probe time, there is a chance to run into a NULL pointer dereference error in the queue mapping code.
Put in a check and an error message that will stop the NULL pointer dereference and notify the user that the VSI is in an indeterminate state.
--- drivers/net/ethernet/intel/ice/ice_base.c | 22 ++++++++++++++------ drivers/net/ethernet/intel/ice/ice_dcb_lib.c | 2 ++ 2 files changed, 18 insertions(+), 6 deletions(-)
drivers/net/ethernet/intel/ice/ice_base.c +16 -6
@@ -738,9 +738,14 @@ void ice_vsi_map_rings_to_vectors(struct ice_vsi *vsi)for (q_id = q_base; q_id < (q_base + tx_rings_per_v); q_id++) {struct ice_tx_ring *tx_ring = vsi->tx_rings[q_id]; - tx_ring->q_vector = q_vector; - tx_ring->next = q_vector->tx.tx_ring; - q_vector->tx.tx_ring = tx_ring; +if (tx_ring) { + tx_ring->q_vector = q_vector; + tx_ring->next = q_vector->tx.tx_ring; + q_vector->tx.tx_ring = tx_ring; + }else { +dev_warn (ice_pf_to_dev (vsi->back),"NULL Tx ring found\n" ); +break ; + } } tx_rings_rem -= tx_rings_per_v;
@@ -755,9 +760,14 @@ void ice_vsi_map_rings_to_vectors(struct ice_vsi *vsi)for (q_id = q_base; q_id < (q_base + rx_rings_per_v); q_id++) {struct ice_rx_ring *rx_ring = vsi->rx_rings[q_id]; - rx_ring->q_vector = q_vector; - rx_ring->next = q_vector->rx.rx_ring; - q_vector->rx.rx_ring = rx_ring; +if (rx_ring) { + rx_ring->q_vector = q_vector; + rx_ring->next = q_vector->rx.rx_ring; + q_vector->rx.rx_ring = rx_ring; + }else { +dev_warn (ice_pf_to_dev (vsi->back),"NULL Rx ring found\n" ); +break ; + } } rx_rings_rem -= rx_rings_per_v; }
drivers/net/ethernet/intel/ice/ice_dcb_lib.c +2 -0
@@ -744,6 +744,8 @@ void ice_pf_dcb_recfg(struct ice_pf *pf)continue ;if (vsi->type ==ICE_VSI_PF ) { +if (ice_dcb_get_num_tc (dcbcfg) > vsi->alloc_txq) +dev_warn (ice_pf_to_dev (vsi->back),"More TCs defined than queues/rings allocated.\n" ); tc_map =ice_dcb_get_ena_tc (dcbcfg);/* If DCBX request non-contiguous TC, then configure
Signature · 1 line
2.35.1
Quoted 9 lines
After decreasing the CPU cores from BIOS and I have disabled CPU from OS level and after applying DCB configuration system getting crash. -----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Ertman, David M
Sent: Friday, May 6, 2022 11:34 PM
To: [email protected]
Subject: [Intel-wired-lan] [PATCH net] ice: prevent low-core machines crashing on DCB configIn the case where the driver is loaded on a low-core (< 8) core system, and then a DCB config applied with the number of traffic classes greater than the number of queues defined at probe time, there is a chance to run into a NULL pointer dereference error in the queue mapping code.
Quoted 8 lines
Put in a check and an error message that will stop the NULL pointer dereference and notify the user that the VSI is in an indeterminate state.
Fixes 3a858ba392c3 ("ice: Add support for VSI allocation and deallocation")Signed-off-by Dave Ertman <[email protected]>---
drivers/net/ethernet/intel/ice/ice_base.c| 22 ++++++++++++++------drivers/net/ethernet/intel/ice/ice_dcb_lib.c| 2 ++2 files changed, 18 insertions(+), 6 deletions(-)
_______________________________________________
Intel-wired-lan mailing list
[email protected]
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan