Article View: linux.kernel.netdev
Article #18305[PATCH net] bnxt_en: Fix auxiliary device leak on early probe failures
From: Changyul Lee
Date: Wed, 18 Nov 2026 05:07
Date: Wed, 18 Nov 2026 05:07
76 lines
13620 bytes
13620 bytes
bnxt_init_one() allocates the auxiliary device ID and initializes the
auxiliary devices before bnxt_set_dflt_rings(). If that call,
bnxt_init_int_mode() or the bnxt_pf_wq allocation fails, probe jumps to
init_err_pci_clean, which does not uninitialize the devices or free the
ID. Only init_err_cleanup does. The devices are never released, so their
aux_priv, edev and ulp_tbl allocations and the ID in bnxt_aux_dev_ids are
leaked once free_netdev() frees bp. A VF probed while the PF is down
fails this way each time.
Add an init_err_auxdev label for this cleanup and use it for every
failure after the devices are initialized. On the register_netdev()
failure path the cleanup now runs after bnxt_clear_int_mode(), in the
reverse order of setup.
Fixes: 2e4592dc9bee ("bnxt_en: Change MSIX/NQs allocation policy")
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 BNXT and W=1.
drivers/net/ethernet/broadcom/bnxt/bnxt.c | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
index e78cf7ad3cbc..ba0e458a467f 100644
--- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c
+++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
@@ -17423,7 +17423,7 @@ static int bnxt_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
netdev_err(bp->dev, "Not enough rings available.\n");
rc = -ENOMEM;
}
- goto init_err_pci_clean;
+ goto init_err_auxdev;
}
bnxt_fw_init_one_p3(bp);
@@ -17435,7 +17435,7 @@ static int bnxt_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
rc = bnxt_init_int_mode(bp);
if (rc)
- goto init_err_pci_clean;
+ goto init_err_auxdev;
/* No TC has been set yet and rings may have been trimmed due to
* limited MSIX, so we re-initialize the TX rings per TC.
@@ -17449,7 +17449,7 @@ static int bnxt_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
if (!bnxt_pf_wq) {
dev_err(&pdev->dev, "Unable to create workqueue.\n");
rc = -ENOMEM;
- goto init_err_pci_clean;
+ goto init_err_auxdev;
}
}
rc = bnxt_init_tc(bp);
@@ -17487,12 +17487,13 @@ static int bnxt_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
return 0;
init_err_cleanup:
- bnxt_aux_devices_uninit(bp);
- bnxt_auxdev_id_free(bp, bp->auxdev_id);
bnxt_dl_unregister(bp);
init_err_dl:
bnxt_shutdown_tc(bp);
bnxt_clear_int_mode(bp);
+init_err_auxdev:
+ bnxt_aux_devices_uninit(bp);
+ bnxt_auxdev_id_free(bp, bp->auxdev_id);
init_err_pci_clean:
bnxt_hwrm_func_drv_unrgtr(bp);
base-commit: 2a324a58a084c5cfd7e5a2f55e0786bee170a4a5
--
2.43.0
Technical Details
Message-ID:
<20261118050716.3873167-1-lcy8047@gmail.com>Path:
mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-365870-linux-kernel-netdev=dewy.ruShow Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-365870-linux-kernel-netdev=dewy.ru
From: lcy8047@gmail.com (Changyul Lee)
Newsgroups: linux.kernel.netdev
Subject: [PATCH net] bnxt_en: Fix auxiliary device leak on early probe failures
Date: Wed, 18 Nov 2026 00:07:16 -0500
Organization: Usenet Network
Message-ID: <20261118050716.3873167-1-lcy8047@gmail.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
logging-data="2509300"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:Tqug37tSmq4mmm/VFKD5vM2ZdnQ= sha256:eN1NykAA0PZVmBu0eGG0cnLx2zyEhfra90vzLc/rvXI=
sha1:B9veN3uKEIxew6tMJXQhmzlyTqk= sha256:YXs/XY6bQZeOlLTHZVvJpnSXZQF/nD1wV20R+C+A8QY=
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 86C221151A4; Wed, 18 Nov 2026 08:07:41 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.149
X-Spam-Status: No, score=-3.149 tagged_above=-9999 required=6.31
tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,
FREEMAIL_FORGED_FROMDOMAIN=0.001, FREEMAIL_FROM=0.001,
HEADER_FROM_DIFFERENT_DOMAINS=0.249, 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=gmail.com
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 fOGfytb3Fcka;
Wed, 18 Nov 2026 08:07:32 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.232.135.74; helo=sto.lore.kernel.org; envelope-from=netdev+bounces-365870-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN>
X-Authentication-Results: OpenDMARC; dmarc=fail (p=none dis=none) header.from=gmail.com
X-Received: from sto.lore.kernel.org (sto.lore.kernel.org [172.232.135.74])
by mail.dewy.ru (Postfix) with ESMTPS id 193C4111D40; Wed, 18 Nov 2026 08:07:23 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
by sto.lore.kernel.org (Postfix) with ESMTP id 9189D61428B; Wed, 18 Nov 2026 05:07:22 +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=1794978442;
b=c3cyQynv1YslJ1EjJf75dGAJVV/vqEG8fYpbuoKXF6FDXhM1mkWoQSFNyjeNEgeidJkY
KCzyUXd1FKyhOetm+sFtlDH1hWicZphbbed4rGB0G/+Iw0nMi6FwAHfknBYE7BdBPKBui
76m53M03kFy23o7GePwY1uMSzY36uJ2OMjSUKQIZL7DQWTtTp3xmW4hiMhdH0QdB6XcEM
gI4w1EYJ/GgoOLiOkCCnktGPThAe7aptrFtEPHRQw0Rku6JOC5KwgNQLWT11a9gCGn0dk
2LzyZrcpM9WROTSLCeAHv/T++4/A/sZwE0WHb4M2V2IlrobTj7KD8nhi6TLIVS5h8nA==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
a=rsa-sha256; c=relaxed/relaxed; t=1794978442;
h=X-Original-To:Received:DMARC-Filter:Received:DKIM-Signature:
X-Google-DKIM-Signature:X-Forwarded-Encrypted:X-Gm-Message-State:
X-Gm-Gg:X-Received:Received:From:To:Cc:Subject:Date:Message-ID:
X-Mailer:X-Mailing-List:List-Id:List-Post:List-Help:List-Subscribe:
List-Unsubscribe:List-Owner:Precedence:MIME-Version:
Content-Transfer-Encoding;
bh=biPK0aG9WHznxprJzM2qILlC7uo+QNVnfuQhkyMYT8A=;
b=zcaNn4V10uJA6qj6/cvdIeDqlkFBRwugjydIiMOfbiMxm+qmQhmgHY9xMcMTn9Z/W7hv
ZwaQZuN70UosWC0WdZyDdOqZkX5cXeA83+RGNZP/OYmDtP9vWVHsfUwf5f6MtAwteJe2S
My/kwHCSAEi3fO3k3c0HeHUBzOzEvzRVU+S9b+gREZ7q0EjTuQje/LCy7Ly5ZweiJSJ0B
VvKBmyGdJsDnd3tJv7jOA/UJYn/JbrxsfFNe519Tt80Flsltaz9SiRXrtt8xORowTCgFH
ugGdpn2dcE1a+yVsjb6vpWNiim/ekk7k3ZptDxC47xzaP3NUmMcnCC7jz7HHgsXpp8Q==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org;
dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b="NOPPV7x/";
dmarc=pass header.from=gmail.com;
spf=pass smtp.mailfrom=gmail.com;
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 00486606A336;
Wed, 18 Nov 2026 05:07:22 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=NOPPV7x/
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.222.176
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
t=1794978441;
b=oDNf0FvX/Q3WF7t7pARXhdJpXL6CqVc8BjAKTcEuoDuNiwrdtfgyXGHF5Hty21lejRYr
0uBGou3KVV2/RYuCI9TEWYKLViJfbR/LlgGaA9QEHq5YxJEXbylNWv9lmRKwbnSGR8NV1
vj6HDfs8fCosP9TNwpoCAnMTYEBMpbYpdmadALeZ1GeIU3zd1HohEXWHXuzKNN/Us9/e2
gcJn6023GH61Mdf/0xr8wP1gsd4pe+bVpMbVErEVRH0tr59DlpPZ8AXrf5k5zDAbkDPWO
aE1XGY4B7SgUJUC/G1TjWD60nEskRVgcQIv0QCL7pYAaq1dMasvHI7BZPxHWzRXR03w==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
a=rsa-sha256; c=relaxed/relaxed; t=1794978441;
h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature:
X-Forwarded-Encrypted:X-Gm-Message-State:X-Gm-Gg:X-Received:Received:
From:To:Cc:Subject:Date:Message-ID:X-Mailer:MIME-Version:
Content-Transfer-Encoding;
bh=biPK0aG9WHznxprJzM2qILlC7uo+QNVnfuQhkyMYT8A=;
b=wxdrmE7/uTIZtQRkxhQWngXW49pratlEUW78jaiYptHrgi2pcwHkKLKIxbrB3RPNOQJ+
bl6HDLnvPOKtFbt1yRBlJKUPrkCYmNJoKlN87/UZOMz7J0d3QMwkCw7Dbhxcj+q60d0A3
HSsD6c9F+R92kz1xI9k6E5+jKkf/oHuC1LR50hZ8J8VUVvHrQ+P/MpBtH3t5KhBtQ6dqK
fi6Mri1T+EyfmptIcLfu+9B/h44kZpNWFk+fkakUylE9oy2iAU7VrflCK3mOxnyWsoutw
wGgpD9aI47JS8EuJjXUYtITjqmJpS9/i4VJ0mvAe3B9nwLjpw+MLqRINmKgSXFNB42w==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org;
dmarc=pass header.from=gmail.com;
spf=pass smtp.mailfrom=gmail.com;
dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b="NOPPV7x/";
arc=none smtp.remote-ip=209.85.222.176
X-Received: from mail-qk1-f176.google.com (mail-qk1-f176.google.com [209.85.222.176])
(using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)
key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256)
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id B9762606A31C
for <netdev@vger.kernel.org>; Wed, 18 Nov 2026 05:07:20 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org B9762606A31C
X-Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com
X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com
X-Received: by mail-qk1-f176.google.com with SMTP id af79cd13be357-930c0f9c1b1so67400885a.1
for <netdev@vger.kernel.org>; Tue, 17 Nov 2026 21:07:20 -0800 (PST)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20260707; t=1794978439; x=1795583239; darn=vger.kernel.org;
h=content-transfer-encoding:mime-version:message-id:date:subject:cc
:to:from:from:to:cc:subject:date:message-id:reply-to:content-type;
bh=biPK0aG9WHznxprJzM2qILlC7uo+QNVnfuQhkyMYT8A=;
b=NOPPV7x/KygcBDhKQjG0je/rXa+iGCWIVdSTAMePQPwenrtjUmL0SBgIW+LoMuRulv
tWgc7E25vQ0ijamr7AmKdxFEQ8CuIX3hIQGPg7sdJ/OgBIUku2pAWrL9Ewb5NeRJEV8f
XNtXwpUOPXEvforek3MmifR1zSl26xNZH1JQbYBiOow739hhAvQpfQn0CQg/AGReeday
7RvxE8tvJoiVKyiNeGLI+AYjHkha9B9f9xzqfgNODQtoWzm2J6tRVUxEzigzxJf+TFEy
IqcYH0h3rEdYV8/TbWwoi+Q7BJNLVJFiWC2OyF9jjImWhNVkhAoNMdOTO9ReyA1aQgxB
DVVA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20260707; t=1794978439; x=1795583239;
h=content-transfer-encoding:mime-version:message-id:date:subject:cc
:to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date
:message-id:reply-to:content-type;
bh=biPK0aG9WHznxprJzM2qILlC7uo+QNVnfuQhkyMYT8A=;
b=XUA4p1sG+Y6qnnPYAVMt/Tru/bIvVEttgYvpRoJjs8pCskwW6beUeE4/JGVaOlCNYz
jvhCW1zGsAwnrv21jocZqVnA2BPvvgsDi2nTGFUWLdCk1MD4OsGWz/+cWBzMhmhfwIL5
PX//u1K3kd2hMk+dep1WeRnrMdDArfmCSMyv2MOA30ilzZuQSHh8nGXmCh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re4QBLVSi5oS/3jJS
q
X-Received: by 2002:a05:620a:4488:b0:949:6193:acc5 with SMTP id af79cd13be357-949996088f0mr308639385a.74.1794978439454;
Tue, 17 Nov 2026 21:07:19 -0800 (PST)
X-Received: from linux.. ([8.34.174.240])
by smtp.gmail.com with ESMTPSA id af79cd13be357-9499b454fa1sm97897485a.3.2026.11.17.21.07.18
(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
Tue, 17 Nov 2026 21:07:19 -0800 (PST)
X-Cc: 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>,
Vikas Gupta <vikas.gupta@broadcom.com>,
Andy Gospodarek <andrew.gospodarek@broadcom.com>,
Jacob Keller <jacob.e.keller@intel.com>,
netdev@vger.kernel.org,
linux-kernel@vger.kernel.org,
Changyul Lee <lcy8047@gmail.com>
X-Mailer: git-send-email 2.43.0
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