Netdev List
 help / color / mirror / Atom feed
From: Ian Rogers <irogers@google.com>
To: 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>
Cc: intel-wired-lan@lists.osuosl.org, netdev@vger.kernel.org,
	 linux-kernel@vger.kernel.org, llvm@lists.linux.dev,
	 Elkin Cruz <elkin@google.com>, Ian Rogers <irogers@google.com>
Subject: [PATCH iwl-net] i40e: ensure owner VSI is found before dereferencing in i40e_veb_release()
Date: Thu, 19 Nov 2026 09:07:41 -0800	[thread overview]
Message-ID: <20261119170741.1525395-1-irogers@google.com> (raw)

i40e_veb_release() counts all VSIs attached to veb->seid in 'n', but only
assigns 'vsi' when I40E_VSI_FLAG_VEB_OWNER is set. If a non-floating VEB
has a single remaining VSI without I40E_VSI_FLAG_VEB_OWNER (for example
if the owner VSI was moved or cleared via debugfs switch operations),
n == 1 passes the 'n != 1' check while 'vsi' remains uninitialized on the
stack and is immediately dereferenced.

Initialize 'vsi' to NULL and refuse to release a non-floating VEB unless
both n == 1 and vsi != NULL.

Found via an x86_64 LLVM=1 (Clang 21.1.8) allyesconfig audit with
-Wconditional-uninitialized enabled; fix and changelog drafted with an AI
coding assistant. Build-tested under LLVM=1 W=1 (-Werror) and
-Wconditional-uninitialized; not tested on Intel XL710/X722 hardware.

Fixes: 08cdde310e22 ("i40e: Fix broken support for floating VEBs")
Signed-off-by: Ian Rogers <irogers@google.com>
---
 drivers/net/ethernet/intel/i40e/i40e_main.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c
index abbc71e815ae..8d4213b7dd92 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_main.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_main.c
@@ -14718,7 +14718,7 @@ static void i40e_veb_clear(struct i40e_veb *veb)
  **/
 void i40e_veb_release(struct i40e_veb *veb)
 {
-	struct i40e_vsi *vsi, *vsi_it;
+	struct i40e_vsi *vsi = NULL, *vsi_it;
 	struct i40e_pf *pf;
 	int i, n = 0;
 
@@ -14735,7 +14735,8 @@ void i40e_veb_release(struct i40e_veb *veb)
 	/* Floating VEB has to be empty and regular one must have
 	 * single owner VSI.
 	 */
-	if ((veb->uplink_seid && n != 1) || (!veb->uplink_seid && n != 0)) {
+	if ((veb->uplink_seid && (n != 1 || !vsi)) ||
+	    (!veb->uplink_seid && n != 0)) {
 		dev_info(&pf->pdev->dev,
 			 "can't remove VEB %d with %d VSIs left\n",
 			 veb->seid, n);
-- 
2.56.1.708.g77570a6a1d-goog


                 reply	other threads:[~2026-11-19 17:07 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20261119170741.1525395-1-irogers@google.com \
    --to=irogers@google.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=anthony.l.nguyen@intel.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@kernel.org \
    --cc=elkin@google.com \
    --cc=intel-wired-lan@lists.osuosl.org \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=llvm@lists.linux.dev \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox