From: Jakub Kicinski <kuba@kernel.org>
To: przemyslaw.kitszel@intel.com
Cc: Jakub Kicinski <kuba@kernel.org>,
netdev@vger.kernel.org, rafal.romanowski@intel.com,
aleksandr.loktionov@intel.com, andrew+netdev@lunn.ch,
edumazet@google.com, marcin.szycik@linux.intel.com,
anthony.l.nguyen@intel.com, horms@kernel.org,
intel-wired-lan@lists.osuosl.org, pabeni@redhat.com,
davem@davemloft.net
Subject: Re: [Intel-wired-lan] [PATCH net v2 2/2] ice: fix stats array overflow via proper realloc
Date: Mon, 17 Aug 2026 13:50:47 -0700 [thread overview]
Message-ID: <20260817205047.3612990-1-kuba@kernel.org> (raw)
In-Reply-To: <20260812204619.32253-3-przemyslaw.kitszel@intel.com>
This is an AI-generated review of your patch. The human sending this
email has considered the AI review valid, or at least plausible.
---
ice: fix stats array overflow via proper realloc
This patch removes ice_vsi_alloc_stat_arrays() and makes
ice_vsi_realloc_stat_arrays() handle the initial (no vsi_stat) case, tracking
the array sizes in the new tx_ring_stats_len / rx_ring_stats_len fields. The
single remaining call site is in ice_vsi_cfg_def(), and the call in
ice_vsi_rebuild() is dropped.
Closes: https://redhat.atlassian.net/browse/RHEL-164321
> diff --git a/drivers/net/ethernet/intel/ice/ice_lib.c b/drivers/net/ethernet/intel/ice/ice_lib.c
> index e48ee5940f17..420e72df7f5e 100644
> --- a/drivers/net/ethernet/intel/ice/ice_lib.c
> +++ b/drivers/net/ethernet/intel/ice/ice_lib.c
[ ... ]
> @@ -2379,7 +2353,7 @@ static int ice_vsi_cfg_def(struct ice_vsi *vsi)
> return ret;
>
> /* allocate memory for Tx/Rx ring stat pointers */
> - ret = ice_vsi_alloc_stat_arrays(vsi);
> + ret = ice_vsi_realloc_stat_arrays(vsi);
> if (ret)
> goto unroll_vsi_alloc;
>
> @@ -3097,10 +3071,6 @@ int ice_vsi_rebuild(struct ice_vsi *vsi, u32 vsi_flags)
>
> mutex_lock(&vsi->xdp_state_lock);
>
> - ret = ice_vsi_realloc_stat_arrays(vsi);
> - if (ret)
> - goto unlock;
> -
> ice_vsi_decfg(vsi);
> ret = ice_vsi_cfg_def(vsi);
> if (ret)
[Severity: Low]
Does moving the ice_vsi_realloc_stat_arrays() call change what happens when
the stat array allocation fails during a rebuild?
Before this patch, ice_vsi_rebuild() did the realloc before
ice_vsi_decfg(), so a krealloc_array() failure returned -ENOMEM with the VSI
still fully configured:
ret = ice_vsi_realloc_stat_arrays(vsi);
if (ret)
goto unlock;
ice_vsi_decfg(vsi);
Now the only call site is inside ice_vsi_cfg_def(), which runs after
ice_vsi_decfg(), so an -ENOMEM there unwinds via unroll_vsi_alloc and is
propagated out of ice_vsi_rebuild() with the queues, vectors and rings
already released.
For the ethtool -L path that leaves ice_vsi_recfg_qs() in ice_main.c with
only this recovery:
rebuild_err:
dev_err(ice_pf_to_dev(pf), "Error during VSI rebuild: %d. Unload and reload the driver.\n",
err);
The same outcome was already reachable pre-patch through the other
allocations in ice_vsi_cfg_def() (ice_vsi_alloc_def(),
ice_vsi_alloc_q_vectors(), ice_vsi_alloc_rings(),
ice_vsi_alloc_ring_stats()), so this adds one more allocation to an
already-destructive region rather than a new failure mode.
The commit message describes the move only as:
Also drop one callsite to avoid some duplication.
Could it also mention that the previously non-destructive failure path for
this allocation is gone?
--
pw-bot: cr
next prev parent reply other threads:[~2026-08-17 20:50 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-12 20:18 [Intel-wired-lan] [PATCH net 0/2][pull request] Intel Wired LAN Driver Updates 2026-08-12 (ice) Przemek Kitszel
2026-08-12 20:18 ` Przemek Kitszel
2026-08-12 20:18 ` [Intel-wired-lan] [PATCH net 1/2] ice: move ice_vsi_realloc_stat_arrays() up Przemek Kitszel
2026-08-12 20:18 ` Przemek Kitszel
2026-08-12 20:18 ` [Intel-wired-lan] [PATCH net v2 2/2] ice: fix stats array overflow via proper realloc Przemek Kitszel
2026-08-12 20:18 ` Przemek Kitszel
2026-08-17 20:50 ` Jakub Kicinski [this message]
2026-08-19 10:52 ` [Intel-wired-lan] " Przemek Kitszel
2026-08-20 21:41 ` Jakub Kicinski
2026-08-17 15:55 ` [Intel-wired-lan] [PATCH net 0/2][pull request] Intel Wired LAN Driver Updates 2026-08-12 (ice) Tony Nguyen
2026-08-17 15:55 ` Tony Nguyen
2026-08-17 20:51 ` [Intel-wired-lan] " Jakub Kicinski
2026-08-17 20:51 ` Jakub Kicinski
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260817205047.3612990-1-kuba@kernel.org \
--to=kuba@kernel.org \
--cc=aleksandr.loktionov@intel.com \
--cc=andrew+netdev@lunn.ch \
--cc=anthony.l.nguyen@intel.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=intel-wired-lan@lists.osuosl.org \
--cc=marcin.szycik@linux.intel.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=przemyslaw.kitszel@intel.com \
--cc=rafal.romanowski@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.