patch 'net/bnxt: add VF ID boundary check before usage' has been queued to stable release 25.11.5
Kevin Traynor
ktraynor at redhat.com
Thu Dec 3 14:02:00 CET 2026
Hi,
FYI, your patch has been queued to stable release 25.11.5
Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 12/08/26. So please
shout if anyone has objections.
Also note that after the patch there's a diff of the upstream commit vs the
patch applied to the branch. This will indicate if there was any rebasing
needed to apply to the stable branch. If there were code changes for rebasing
(ie: not only metadata diffs), please double check that the rebase was
correctly done.
Queued patches are on a temporary branch at:
https://github.com/kevintraynor/dpdk-stable
This queued commit can be viewed at:
https://github.com/kevintraynor/dpdk-stable/commit/8c71e5b9a0edb66769c86d03b475e47039ceb638
Thanks.
Kevin
---
>From 8c71e5b9a0edb66769c86d03b475e47039ceb638 Mon Sep 17 00:00:00 2001
From: Joseph Wong <joseph.wong at broadcom.com>
Date: Tue, 29 Sep 2026 12:04:18 -0600
Subject: [PATCH] net/bnxt: add VF ID boundary check before usage
[ upstream commit af6aa0ad434b663ef6588e6a4dbc6dc26e70c1b8 ]
bnxt_handle_fwd_req() computed vf_id from an unvalidated,
firmware-controlled source_id and used it to index
bp->pf->vf_info[] before checking that the ID falls within the
active VF range. An out-of-range VF ID could index past
vf_info[] and cause memory corruption.
Move the range check ahead of the vf_id computation and the
vf_info[] lookup. Initialize fwd_cmd/req_len to NULL/0 at
declaration so they're always safe to use on the reject path,
which also silences a GCC 8 false-positive uninitialized-variable
warning in non-debug builds. Also guard
bnxt_hwrm_reject_fwd_resp()'s memcpy() against a NULL encaped
pointer for the same reason.
Fixes: f2a768d4d186 ("net/bnxt: add completion ring")
Signed-off-by: Joseph Wong <joseph.wong at broadcom.com>
Signed-off-by: Mohammad Shuab Siddique <mohammad-shuab.siddique at broadcom.com>
---
drivers/net/bnxt/bnxt_cpr.c | 27 ++++++++++++++-------------
drivers/net/bnxt/bnxt_hwrm.c | 3 ++-
2 files changed, 16 insertions(+), 14 deletions(-)
diff --git a/drivers/net/bnxt/bnxt_cpr.c b/drivers/net/bnxt/bnxt_cpr.c
index 5c255de59e..edbfc14ec6 100644
--- a/drivers/net/bnxt/bnxt_cpr.c
+++ b/drivers/net/bnxt/bnxt_cpr.c
@@ -363,8 +363,8 @@ void bnxt_handle_fwd_req(struct bnxt *bp, struct cmpl_base *cmpl)
struct hwrm_exec_fwd_resp_input *fwreq;
struct hwrm_fwd_req_cmpl *fwd_cmpl = (struct hwrm_fwd_req_cmpl *)cmpl;
- struct input *fwd_cmd;
+ struct input *fwd_cmd = NULL;
uint16_t fw_vf_id;
uint16_t vf_id;
- uint16_t req_len;
+ uint16_t req_len = 0;
int rc;
@@ -376,4 +376,15 @@ void bnxt_handle_fwd_req(struct bnxt *bp, struct cmpl_base *cmpl)
/* Qualify the fwd request */
fw_vf_id = rte_le_to_cpu_16(fwd_cmpl->source_id);
+
+ if (fw_vf_id < bp->pf->first_vf_id ||
+ fw_vf_id >= bp->pf->first_vf_id + bp->pf->active_vfs) {
+ PMD_DRV_LOG_LINE(ERR,
+ "FWD req's source_id 0x%x out of range 0x%x - 0x%x (%d %d)",
+ fw_vf_id, bp->pf->first_vf_id,
+ (bp->pf->first_vf_id) + bp->pf->active_vfs - 1,
+ bp->pf->first_vf_id, bp->pf->active_vfs);
+ goto reject;
+ }
+
vf_id = fw_vf_id - bp->pf->first_vf_id;
@@ -387,14 +398,4 @@ void bnxt_handle_fwd_req(struct bnxt *bp, struct cmpl_base *cmpl)
fwd_cmd = (struct input *)bp->pf->vf_info[vf_id].req_buf;
- if (fw_vf_id < bp->pf->first_vf_id ||
- fw_vf_id >= bp->pf->first_vf_id + bp->pf->active_vfs) {
- PMD_DRV_LOG_LINE(ERR,
- "FWD req's source_id 0x%x out of range 0x%x - 0x%x (%d %d)",
- fw_vf_id, bp->pf->first_vf_id,
- (bp->pf->first_vf_id) + bp->pf->active_vfs - 1,
- bp->pf->first_vf_id, bp->pf->active_vfs);
- goto reject;
- }
-
if (bnxt_rcv_msg_from_vf(bp, vf_id, fwd_cmd)) {
/*
@@ -496,5 +497,5 @@ reject:
"Failed to send REJECT req VF 0x%x, type 0x%x.",
fw_vf_id - bp->pf->first_vf_id,
- rte_le_to_cpu_16(fwd_cmd->req_type));
+ fwd_cmd ? rte_le_to_cpu_16(fwd_cmd->req_type) : 0xFFFF);
}
diff --git a/drivers/net/bnxt/bnxt_hwrm.c b/drivers/net/bnxt/bnxt_hwrm.c
index 4fb184fb8e..1c84fd8920 100644
--- a/drivers/net/bnxt/bnxt_hwrm.c
+++ b/drivers/net/bnxt/bnxt_hwrm.c
@@ -5523,5 +5523,6 @@ int bnxt_hwrm_exec_fwd_resp(struct bnxt *bp, uint16_t target_id,
req.encap_resp_target_id = rte_cpu_to_le_16(target_id);
- memcpy(req.encap_request, encaped, ec_size);
+ if (encaped)
+ memcpy(req.encap_request, encaped, ec_size);
rc = bnxt_hwrm_send_message(bp, &req, sizeof(req), BNXT_USE_CHIMP_MB);
--
2.56.1
---
Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- - 2026-12-03 12:52:44.779915688 +0000
+++ 0194-net-bnxt-add-VF-ID-boundary-check-before-usage.patch 2026-12-03 12:52:39.171938687 +0000
@@ -1 +1 @@
-From af6aa0ad434b663ef6588e6a4dbc6dc26e70c1b8 Mon Sep 17 00:00:00 2001
+From 8c71e5b9a0edb66769c86d03b475e47039ceb638 Mon Sep 17 00:00:00 2001
@@ -5,0 +6,2 @@
+[ upstream commit af6aa0ad434b663ef6588e6a4dbc6dc26e70c1b8 ]
+
@@ -21 +22,0 @@
-Cc: stable at dpdk.org
@@ -84 +85 @@
-index 42ed6e5ae1..ee5c81501e 100644
+index 4fb184fb8e..1c84fd8920 100644
@@ -87 +88 @@
-@@ -5520,5 +5520,6 @@ int bnxt_hwrm_reject_fwd_resp(struct bnxt *bp, uint16_t target_id,
+@@ -5523,5 +5523,6 @@ int bnxt_hwrm_exec_fwd_resp(struct bnxt *bp, uint16_t target_id,
More information about the stable
mailing list