patch 'net/bnxt: add VF ID boundary check before usage' has been queued to stable release 24.11.9
luca.boccassi at gmail.com
luca.boccassi at gmail.com
Tue Oct 27 12:50:55 CET 2026
Hi,
FYI, your patch has been queued to stable release 24.11.9
Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 10/29/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/bluca/dpdk-stable
This queued commit can be viewed at:
https://github.com/bluca/dpdk-stable/commit/cc90d00c771c44f4b5c6321fc134199a8bbd5e0c
Thanks.
Luca Boccassi
---
>From cc90d00c771c44f4b5c6321fc134199a8bbd5e0c 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 5c255de59ea..edbfc14ec60 100644
--- a/drivers/net/bnxt/bnxt_cpr.c
+++ b/drivers/net/bnxt/bnxt_cpr.c
@@ -362,10 +362,10 @@ 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;
if (bp->pf->active_vfs <= 0) {
@@ -375,6 +375,17 @@ 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;
req_len = (rte_le_to_cpu_16(fwd_cmpl->req_len_type) &
@@ -386,16 +397,6 @@ void bnxt_handle_fwd_req(struct bnxt *bp, struct cmpl_base *cmpl)
/* Locate VF's forwarded command */
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)) {
/*
* In older firmware versions, the MAC had to be all zeros for
@@ -495,7 +496,7 @@ reject:
PMD_DRV_LOG_LINE(ERR,
"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);
}
return;
diff --git a/drivers/net/bnxt/bnxt_hwrm.c b/drivers/net/bnxt/bnxt_hwrm.c
index 0c026faeae0..fcf9d5a7d83 100644
--- a/drivers/net/bnxt/bnxt_hwrm.c
+++ b/drivers/net/bnxt/bnxt_hwrm.c
@@ -5502,7 +5502,8 @@ int bnxt_hwrm_reject_fwd_resp(struct bnxt *bp, uint16_t target_id,
HWRM_PREP(&req, HWRM_REJECT_FWD_RESP, BNXT_USE_CHIMP_MB);
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.47.3
---
Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- - 2026-10-27 11:43:59.909204627 +0000
+++ 0161-net-bnxt-add-VF-ID-boundary-check-before-usage.patch 2026-10-27 11:43:53.726066011 +0000
@@ -1 +1 @@
-From af6aa0ad434b663ef6588e6a4dbc6dc26e70c1b8 Mon Sep 17 00:00:00 2001
+From cc90d00c771c44f4b5c6321fc134199a8bbd5e0c Mon Sep 17 00:00:00 2001
@@ -5,0 +6,2 @@
+[ upstream commit af6aa0ad434b663ef6588e6a4dbc6dc26e70c1b8 ]
+
@@ -21 +22,0 @@
-Cc: stable at dpdk.org
@@ -31 +32 @@
-index 5c255de59e..edbfc14ec6 100644
+index 5c255de59ea..edbfc14ec60 100644
@@ -92 +93 @@
-index 42ed6e5ae1..ee5c81501e 100644
+index 0c026faeae0..fcf9d5a7d83 100644
@@ -95 +96 @@
-@@ -5519,7 +5519,8 @@ int bnxt_hwrm_reject_fwd_resp(struct bnxt *bp, uint16_t target_id,
+@@ -5502,7 +5502,8 @@ int bnxt_hwrm_reject_fwd_resp(struct bnxt *bp, uint16_t target_id,
More information about the stable
mailing list