From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp3.osuosl.org (smtp3.osuosl.org [140.211.166.136]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7AF5F606A327 for ; Mon, 30 Nov 2026 10:30:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=osuosl.org header.i=@osuosl.org header.a=rsa-sha256 header.s=default header.b=WyXhE+tR; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=Ed0ds06c Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id 5616F605EF; Mon, 30 Nov 2026 10:30:45 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id 7jg48393KtCf; Mon, 30 Nov 2026 10:30:44 +0000 (UTC) ARC-Filter: OpenARC Filter v1.3.2 smtp3.osuosl.org 99997605DF Authentication-Results: smtp3.osuosl.org; arc=none smtp.remote-ip=140.211.166.142 ARC-Seal: i=1; d=osuosl.org; s=arc; a=rsa-sha256; cv=none; t=1796034644; b=bOjDJJaVPfEcSrffBH8UH1tVSIc4vQnxBJdtltNvbtRNfd0Zf+ox4r+ozyhlJkmvFPQc LYTu4ZHJm2sq5ea033LhI2FIaIXjKnrm/C0eK/420QBM9Jm/Seb7UGzPSLwMP/frvUK+L KOBJS3eXPhsBrup24m/WFXbGgXL+snXSZc5g2IH/dPPxHCR90ZjpAUNsnyj5sNM5jyfBb rakv285T4OrMJPmdrDvyemtDPMqj27QcOkCtP0irUxuZ/m2QirlSmDHW3DoX5jMT4S6sK /y0KahT+cpNyoaNZu1tlbwsbcL3auA8kZ9a5EJK8Vx1mpnTBhkByuglPjdSALopajsA== ARC-Message-Signature: i=1; d=osuosl.org; s=arc; a=rsa-sha256; c=relaxed/relaxed; t=1796034644; h=X-Comment:DKIM-Signature:X-Original-To:Delivered-To:Received: Received:X-Virus-Scanned:X-Spam-Flag:X-Spam-Score:X-Spam-Level: X-Spam-Status:Received:ARC-Filter:Received-SPF:Received:Received: Received:DKIM-Signature:Date:From:To:Cc:Subject:Message-ID:References: MIME-Version:Content-Type:Content-Disposition:In-Reply-To:X-BeenThere: X-Mailman-Version:Precedence:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:Errors-To; bh=auA5TOAps0rC4vEDM9ELEwX2STCGDjacOzZfOJxJok4=; b=fW71pGH3Mezrk6GaDgdBuqww545G3VHo6i94mK7QAf5h7QNWphZUoSeU8qbwzX6HTCyk 32PujqWlBAce9S+8A5NSkChLmqPqoGzn2gSx7dcjsCsPe1r55LrqJ/2H+RKlgtC4SR01v fiXjF8xN51v37v4OctMBSa6kotlmg/VziFtSSbueu2zUib4Hv0NyCeVFQykm99orPqxVU HHMGc9Pmd43feSDq8cuA0L0XFATQAJdecMYQbzRTrz4u8AvW5oJ2G1QIaWk4MVc+5PfWh +650OJ8Ps4hsVYngAc8Zuse+g/LHUZSSBrQSLrJYdJBCVG0ZBqena/ChFDYU1VboheQ== ARC-Authentication-Results: i=1; smtp3.osuosl.org; arc=none smtp.remote-ip=140.211.166.142 X-Comment: SPF check N/A for local connections - client-ip=140.211.166.142; helo=lists1.osuosl.org; envelope-from=intel-wired-lan-bounces@osuosl.org; receiver= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=osuosl.org; s=default; t=1796034644; bh=auA5TOAps0rC4vEDM9ELEwX2STCGDjacOzZfOJxJok4=; h=Date:From:To:Cc:Subject:References:In-Reply-To:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=WyXhE+tROI+4T7hCgOYnru6zzGx9KYq73zy4LK9LUDBb5pHBIzqPmAVpCqkfQhty+ HqT7Fo6ryVrFJ7Uy1vMgwdLdes+H7uYfsDGFZU6fV+zdgY4vvKVyewn8dTn5Bv3s7U KJveO7mcKc95zrr0KpepxQQfqYgBtTCj1PfG1gTBCFL3IiNEJagKGaCYIyPiENWzc8 MiWGQLdjioYos56XMLdhxGX4k+IyLioXHYC0EksVoMIfYUT3aXrL4DVZ6BIcy9bsap ouwvT4mw9EGwaxqdtsYpgGduOyTx0dm5zZkL36RvV/yOgIm0G8AmLa3qK0QoAu+Cdn 3eYoecB/pRW+Q== Received: from lists1.osuosl.org (lists1.osuosl.org [140.211.166.142]) by smtp3.osuosl.org (Postfix) with ESMTP id 99997605DF; Mon, 30 Nov 2026 10:30:44 +0000 (UTC) Received: from smtp1.osuosl.org (smtp1.osuosl.org [140.211.166.138]) by lists1.osuosl.org (Postfix) with ESMTP id 2AA5A712 for ; Mon, 30 Nov 2026 10:30:43 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id 1C8E580BC4 for ; Mon, 30 Nov 2026 10:30:43 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp1.osuosl.org ([127.0.0.1]) by localhost (smtp1.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id SL2qWZROHwkH for ; Mon, 30 Nov 2026 10:30:42 +0000 (UTC) ARC-Filter: OpenARC Filter v1.3.2 smtp1.osuosl.org A6D9080BC0 Authentication-Results: smtp1.osuosl.org; arc=none smtp.remote-ip="2600:3c04:e001:324:0:1991:8:25" Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=2600:3c04:e001:324:0:1991:8:25; helo=tor.source.kernel.org; envelope-from=horms@kernel.org; receiver= Authentication-Results: smtp1.osuosl.org; dmarc=pass (p=quarantine dis=none) header.from=kernel.org Authentication-Results: smtp1.osuosl.org; dkim=pass (2048-bit key, unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=Ed0ds06c Received: from tor.source.kernel.org (tor.source.kernel.org [IPv6:2600:3c04:e001:324:0:1991:8:25]) by smtp1.osuosl.org (Postfix) with ESMTPS id A6D9080BC0 for ; Mon, 30 Nov 2026 10:30:41 +0000 (UTC) Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) by tor.source.kernel.org (Postfix) with ESMTP id CBD3B61E99; Mon, 30 Nov 2026 10:30:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 515071F00898; Mon, 30 Nov 2026 10:30:37 +0000 (UTC) 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== Date: Mon, 30 Nov 2026 10:30:34 +0000 From: Simon Horman To: Changyul Lee Cc: Tony Nguyen , Przemek Kitszel , Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Marcin Szycik , Dave Ertman , 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 Message-ID: <20261130103034.GC804035@horms.kernel.org> References: <20261120033910.1731258-1-lcy8047@gmail.com> X-Archived-By: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20261120033910.1731258-1-lcy8047@gmail.com> X-BeenThere: intel-wired-lan@osuosl.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Intel Wired Ethernet Linux Kernel Driver Development List-Archive: List-Post: List-Help: List-Subscribe: , X-Spam-Status: No, score=-15.9 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=4.0.1 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on aws-us-west-2-korg-listserv-alma10-1 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 > --- > 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 >