Intel-Wired-Lan Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Changyul Lee" <lcy8047@gmail.com>
Cc: intel-wired-lan@lists.osuosl.org
Subject: Re: [PATCH iwl-net] ice: hold a VF reference while creating LAG placeholder VSIs
Date: Sat, 21 Nov 2026 03:39:22 +0000	[thread overview]
Message-ID: <sashiko-outbox-226595@kernel.org> (raw)
In-Reply-To: <20261120033910.1731258-1-lcy8047@gmail.com>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [High] ice: UAF on placeholder VSI nvsi->vf after ice_put_vf() in
  ice_lag_monitor_act_act()
--

commit 78df21de98f414a15f945d5648335b162e30040a
Author: Changyul Lee <lcy8047@gmail.com>

ice: hold a VF reference while creating LAG placeholder VSIs

This commit replaces the ice_for_each_vf() walk in
ice_lag_monitor_act_act() with an indexed lookup via ice_get_vf_by_id()
and ice_put_vf() so a VF reference is held while creating secondary PF
placeholder VSIs.

> diff --git a/drivers/net/ethernet/intel/ice/ice_lag.c b/drivers/net/ethernet/intel/ice/ice_lag.c
> index c4b8af01e2af0..e0803c2a3e8cd 100644
> --- a/drivers/net/ethernet/intel/ice/ice_lag.c
> +++ b/drivers/net/ethernet/intel/ice/ice_lag.c
> @@ -1913,18 +1913,24 @@ static void ice_lag_monitor_act_act(struct ice_lag *lag,
>  				struct ice_vsi_cfg_params params = {};
>  				struct ice_vsi *nvsi;
>  				struct ice_vf *vf;
> -				unsigned int bkt;
>  
>  				params.type = ICE_VSI_VF;
>  				params.port_info = event_pf->hw.port_info;
>  				params.flags = ICE_VSI_FLAG_INIT;
>  
> -				ice_for_each_vf(lag->pf, bkt, vf) {
> +				for (u16 vf_id = 0;
> +				     vf_id < lag->pf->vfs.num_supported;
> +				     vf_id++) {
> +					vf = ice_get_vf_by_id(lag->pf, vf_id);
> +					if (!vf)
> +						continue;
> +
>  					params.vf = vf;
>  					nvsi = ice_vsi_setup(event_pf,
>  							     &params);
>  					ice_lag_aa_clear_spoof(nvsi);
>  					lag->sec_vf[vf->vf_id] = nvsi;
> +					ice_put_vf(vf);
>  				}
>  			}

[Severity: High]
Does dropping the VF reference right after ice_vsi_setup() leave
nvsi->vf dangling if SR-IOV is disabled before the bond unlinks?

ice_vsi_setup() copies params.vf into nvsi->vf without taking its own
reference, and ice_free_vfs() drops the VF table references and frees
struct ice_vf without releasing lag->sec_vf[].  When the bond later
unlinks, ice_lag_changeupper_event() calls ice_vsi_release() on
lag->sec_vf[i], which dereferences the freed nvsi->vf in
ice_vf_is_lldp_ena(vsi->vf) and ice_vsi_delete_from_hw() ->
vsi->vf->vf_id.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261120033910.1731258-1-lcy8047@gmail.com?part=1

      reply	other threads:[~2026-11-21  3:39 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-20  3:39 [PATCH iwl-net] ice: hold a VF reference while creating LAG placeholder VSIs Changyul Lee
2026-11-21  3:39 ` sashiko-bot [this message]

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=sashiko-outbox-226595@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=intel-wired-lan@lists.osuosl.org \
    --cc=lcy8047@gmail.com \
    --cc=sashiko-reviews@lists.linux.dev \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox