Article View: linux.kernel.netdev
Article #24554Re: [PATCH iwl-net] ice: hold a VF reference while creating LAG placeholder VSIs
From: Simon Horman
Date: Mon, 30 Nov 2026 10:30
Date: Mon, 30 Nov 2026 10:30
66 lines
10301 bytes
10301 bytes
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
>
Technical Details
Message-ID:
<20261130103034.GC804035@horms.kernel.org>Path:
mbox-mo1.pugleaf.net!srv.newsdeef.eu!news.mb-net.net!open-news-network.org!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-374106-linux-kernel-netdev=dewy.ruReferences:
<20261120033910.1731258-1-lcy8047@gmail.com>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!news.mb-net.net!open-news-network.org!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-374106-linux-kernel-netdev=dewy.ru From: horms@kernel.org (Simon Horman) Newsgroups: linux.kernel.netdev Subject: Re: [PATCH iwl-net] ice: hold a VF reference while creating LAG placeholder VSIs Date: Mon, 30 Nov 2026 10:30:34 +0000 Organization: Usenet Network Message-ID: <20261130103034.GC804035@horms.kernel.org> References: <20261120033910.1731258-1-lcy8047@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: usenet.network; logging-data="1403528"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:pNECXt3/lifcJvFsQobc6vtQPiw= sha256:ShmQn5eluTcMYXKs51A3xQacHJcbP2CV2xJcxDNXMZ4= sha1:E7CRJLCqe1+ibxhAplhgUKw9ULc= sha256:XQNF4dvG+NHzeAfAMesrUaBNurfiNwRUPe7JVLXIcLc= Content-Disposition: inline List-ID: <netdev.vger.kernel.org> X-Mailpost-Empty-Hdrs: X-Spam-Level X-Received: from localhost (localhost [127.0.0.1]) by mail.dewy.ru (Postfix) with ESMTP id F2280125FDC; Mon, 30 Nov 2026 13:30:56 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.501 X-Spam-Status: No, score=-3.501 tagged_above=-9999 required=6.31 tests=[DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001] autolearn=ham autolearn_force=no X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key) header.d=kernel.org X-Received: from mail.dewy.ru ([127.0.0.1]) by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id BQEuKKg1iQbw; Mon, 30 Nov 2026 13:30:53 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=netdev+bounces-374106-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> X-Authentication-Results: OpenDMARC; dmarc=pass (p=quarantine dis=none) header.from=kernel.org X-Received: from tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114]) by mail.dewy.ru (Postfix) with ESMTPS id 0B16D125FD5; Mon, 30 Nov 2026 13:30:42 +0300 (MSK) X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by tor.lore.kernel.org (Postfix) with ESMTP id 09196264AA; Mon, 30 Nov 2026 10:30:41 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1796034640; b=3IxtICUoR6D848sc5E9JW7k/F62lQHOvIgI80i4N0eMtCs6NWjKPRp9PtNYGy8YjXt0+ i3t+Ib7lyt3/5xiQO9N9PSXq/QZY7owv1fPv074BQjpwWW4W9knyWvqH0b5BghV2L9Doy 3yAyNo7ma09KWq1SyDkJ8nz70vDbr1bpouc8kOzRJwvnpCkn22OfQ1JdlEZLBL2b0rTOS K5Igqiquzv+xZcjd/OwyFYJ2GaCJehpCY7gmm/D2JhelbXrh1RpqMcBWno34FI9mo5wfc bEInAWhuLfw4IJlWBX/NNufVD5pJZamt2XxcEizNLYrsWg8fEZBEcRcf5MYUEOPKRug== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796034640; h=X-Original-To:Received:Received:DKIM-Signature:Date:From:To:Cc: Subject:Message-ID:References:X-Mailing-List:List-Id:List-Post: List-Help:List-Subscribe:List-Unsubscribe:List-Owner:Precedence: MIME-Version:Content-Type:Content-Disposition:In-Reply-To; bh=auA5TOAps0rC4vEDM9ELEwX2STCGDjacOzZfOJxJok4=; b=h/MS8nAplNR7XOwDUjAGu1g9H983Av+pTtxAX5QWOh96oIyzmCQDSv9CGi9gL08S+UPO mQsLiNMYdvDb4JJ4z/bXnxtNPjz7SZyaUMUoYOX8QS4KutU0DJ/JBJT+Y9BJWwhj4aLXJ v1ot4gtU5UccK/D5HKk9H8dQ2m5oO9uhuwgs9Dby/Z6WCkDwg+2uEqmR9+2duiBY4jq6I CiFiKMHzKKfnOoJui2Jv7X9XajFQeXstRjFXXMCNdlsBFAEXVS6OZqjAysvGkvDhGJW4Z SVB5NlizVEvvoDOMkiLhTd0I/1/0ESE0DKtzdU87o6m3WS5BqzzGZn8Ej7D1QF5RBEA== X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=Ed0ds06c; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-Received: from localhost.localdomain (localhost [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C110B606A334; Mon, 30 Nov 2026 10:30:40 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=Ed0ds06c X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796034639; b=kvMz5HIh1hhZjBQmIRlJUVbODG+D7Tg+9UbWTZzy46Kc/cqQHdeEdxd3S9mCTu6r+iPM /ruamr6ppa/6ztgubNgLodwj3dqIPqvT+iJA/69yHRkQ6EfCsmpQG6n65flK1Mbg0BGTG K8qr5Pb00E22s+gWm74WCEfEATgMkhWFcDB3zh7XnveqHrretMiJUUa7lv+xt2kjXqCQs rR7uy2f8V2xBFEH3NdCsyfO4f8qH8RC7gyiv4m6mBhfbOM9Bw84f7nZmtxpuYwg36j5l+ oC6+PDpeRt7+Tr+Q+5SJcUNI/VYLVy6P7+HVLm6sc7nbXdfnvRGr2UPaRNYbg36/Rog== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796034639; h=Received:DKIM-Signature:Date:From:To:Cc:Subject:Message-ID: References:MIME-Version:Content-Type:Content-Disposition:In-Reply-To; bh=auA5TOAps0rC4vEDM9ELEwX2STCGDjacOzZfOJxJok4=; b=ofOoW09hGs84aulVx6L0LAIyq8trI6gbNJKcrDWnYvMM23JG/M/E9GuNNao+YQVTud9I ckWBL+5Y3kpx7zkAY3Ob8LtyWS1eL+GwpIoaNgGRmdQeW6tIgbiQhDXBX53/BxrhR3Dnr 7CFTgHNYoGVHiUNbJhGedPnYybRcfjKGXbRT3Bf2XdE5KCRekHjsOLWjHJOJpkx2qRObY VNiv2GagUO1u0i1PrqGH3Li5gl7fP1/TyeYv64Qirr/oxlQWk8C8K+uEUjYxeq84a7bNZ 6iWSyMjSdGHmW1GvSwRWvXQnVId1r2xRWl0N8wAn4XehxuQeNE1G5v+fOMp50mXR/ZQ== X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=Ed0ds06c; arc=none smtp.remote-ip=100.103.45.18 X-Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DFA55606A327 for <netdev@vger.kernel.org>; Mon, 30 Nov 2026 10:30:39 +0000 (UTC) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 515071F00898; Mon, 30 Nov 2026 10:30:37 +0000 (UTC) X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796034639; bh=auA5TOAps0rC4vEDM9ELEwX2STCGDjacOzZfOJxJok4=; h=Date:From:To:Cc:Subject:References:In-Reply-To; b=Ed0ds06cZL2jkG6OXWZRXjZrQVTyT77S16wbTsNP2brElfKu+ucIm9etcuGdKWw0c snlqO2uDS5c0IqqjVQoAed1vCO0gUA7TkkfxI3kcxIAeH3O/1Wm0zFvYH++fIQaDdG JjDoOrcSoPJwBBsMFTfBv203iw8ruUnbNDIkE037cEIy857X2B+btAiAGDDqGF4Ypx dWLfvo6XWB46YEF4wwK4I5F4mgrMvxLh/Yb4eBAO1/ZvldcsfRlJnMVn9w9NsrwuZO e1ZpvNL8SR2Y6DNcAnDqsNE9Vm5oy8wmy1wVzTQV+PQ64Xz61VBHlSQwD3seF5o7cg TN3ex/g5XvjrA== X-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 X-Mailing-List: netdev@vger.kernel.org X-List-Post: <mailto:netdev@vger.kernel.org> X-List-Help: <mailto:netdev+help@vger.kernel.org> X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org> X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org> X-List-Owner: <mailto:netdev+owner@vger.kernel.org> X-Precedence: list X-In-Reply-To: <20261120033910.1731258-1-lcy8047@gmail.com>