From: Simon Horman <horms@kernel.org>
To: Changyul Lee <lcy8047@gmail.com>
Cc: Tony Nguyen <anthony.l.nguyen@intel.com>,
Przemek Kitszel <przemyslaw.kitszel@intel.com>,
Andrew Lunn <andrew+netdev@lunn.ch>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@kernel.org>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Marcin Szycik <marcin.szycik@linux.intel.com>,
Dave Ertman <david.m.ertman@intel.com>,
intel-wired-lan@lists.osuosl.org, netdev@vger.kernel.org
Subject: Re: [PATCH iwl-net] ice: hold a VF reference while creating LAG placeholder VSIs
Date: Mon, 30 Nov 2026 10:30:34 +0000 [thread overview]
Message-ID: <20261130103034.GC804035@horms.kernel.org> (raw)
In-Reply-To: <20261120033910.1731258-1-lcy8047@gmail.com>
On Thu, Nov 19, 2026 at 10:39:10PM -0500, Changyul Lee wrote:
> When the secondary port of an active-active bond comes up, the driver
> creates a placeholder VSI for each VF. It walks the VF table with
> ice_for_each_vf() while holding only pf->lag_mutex. If SR-IOV is disabled
> during the walk, ice_free_vfs() can remove a VF and drop its last
> reference while the walk still uses it.
>
> Taking table_lock or vf->cfg_lock here would reverse the lock order used
> by VF reset, which can hold both locks before taking pf->lag_mutex.
>
> Iterate over VF IDs and look up each VF with ice_get_vf_by_id(). This
> holds a reference until ice_put_vf(), keeping the VF alive through
> placeholder VSI setup, even if ice_vsi_setup() sleeps.
>
> Fixes: 28f073b38372 ("ice: Implement support for SRIOV VFs across Active/Active bonds")
> Signed-off-by: Changyul Lee <lcy8047@gmail.com>
> ---
> Found with a static analysis tool we are developing.
>
> Compile-tested only, with x86_64_defconfig plus PCI_IOV, ICE and W=1.
>
> drivers/net/ethernet/intel/ice/ice_lag.c | 10 ++++++++--
> 1 file changed, 8 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/net/ethernet/intel/ice/ice_lag.c b/drivers/net/ethernet/intel/ice/ice_lag.c
> index c4b8af01e2af..e0803c2a3e8c 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;
I am concerned that num_supported may change while the loop is iterating.
And if so, the effect that may have on the correctness of overall
operations performed by the loop.
> + vf_id++) {
> + vf = ice_get_vf_by_id(lag->pf, vf_id);
> + if (!vf)
> + continue;
> +
> params.vf = vf;
> nvsi = ice_vsi_setup(event_pf,
> ¶ms);
> ice_lag_aa_clear_spoof(nvsi);
> lag->sec_vf[vf->vf_id] = nvsi;
> + ice_put_vf(vf);
> }
> }
>
>
> base-commit: bf9edda440e747a4a9b351656a395f0b77cc1fef
> --
> 2.43.0
>
prev parent reply other threads:[~2026-11-30 10:30 UTC|newest]
Thread overview: 3+ 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
2026-11-30 10:30 ` Simon Horman [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=20261130103034.GC804035@horms.kernel.org \
--to=horms@kernel.org \
--cc=andrew+netdev@lunn.ch \
--cc=anthony.l.nguyen@intel.com \
--cc=davem@davemloft.net \
--cc=david.m.ertman@intel.com \
--cc=edumazet@kernel.org \
--cc=intel-wired-lan@lists.osuosl.org \
--cc=kuba@kernel.org \
--cc=lcy8047@gmail.com \
--cc=marcin.szycik@linux.intel.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=przemyslaw.kitszel@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.