Thread (6 messages) 6 messages, 2 authors, 21d ago

Re: [PATCH iwl-net 2/2] ice: fix stats array overflow via proper realloc

From: Przemek Kitszel <przemyslaw.kitszel@intel.com>
Date: 2026-07-02 14:09:45
Also in: intel-wired-lan

quoted hunk ↗ jump to hunk
  /**
   * 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++) {
  
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help