/**
   * ice_vsi_alloc_def - set default values for already allocated VSI
   * @vsi: ptr to VSI
@@ -2319,7 +2274,17 @@ static int ice_vsi_realloc_stat_arrays(struct ice_vsi 
*vsi)
        u16 prev_txq = vsi->alloc_txq;
        u16 prev_rxq = vsi->alloc_rxq;
+ if (vsi->type == ICE_VSI_CHNL)
+               return 0;
+
        vsi_stat = pf->vsi_stats[vsi->idx];
+       if (!vsi_stat) {
+               vsi_stat = kzalloc_obj(*vsi_stat);
+               if (!vsi_stat)
+                       return -ENOMEM;
+
+               pf->vsi_stats[vsi->idx] = vsi_stat;
+       }

sashiko [1] points out that if there will be allocation error
later we will end up with, say, vsi_stat->tx_ring_stats == NULL,
but ice_vsi_free_stats() will try to dereference it

will post v2 with a fix

[1] https://sashiko.dev/#/patchset/20260701104141.9740-1-przemyslaw.kitszel%40intel.com

if (req_txq < prev_txq) {
                for (int i = req_txq; i < prev_txq; i++) {

Reply via email to