patch 'net/bnxt: fix NVRAM directory integer overflow' has been queued to stable release 25.11.5

Kevin Traynor ktraynor at redhat.com
Thu Dec 3 14:02:07 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/c87d85bcddf8e78e2474623404373e3fde717118

Thanks.

Kevin

---
>From c87d85bcddf8e78e2474623404373e3fde717118 Mon Sep 17 00:00:00 2001
From: Joseph Wong <joseph.wong at broadcom.com>
Date: Thu, 28 May 2026 22:31:22 -0700
Subject: [PATCH] net/bnxt: fix NVRAM directory integer overflow

[ upstream commit b2c95eacbcdbe03b7cdae7133b1f3faba300f99b ]

Add bounds checking in bnxt_get_nvram_directory() to prevent a length
underflow when subtracting 2 from the input length, and an integer
overflow when calculating the required buffer length. Also enforce
firmware-supplied upper bounds on the directory entry count and entry
length, guarding against an undersized DMA buffer if firmware reports
implausible values, and use 64-bit arithmetic for the buffer size
calculation. The two returned values are each written back as a
single byte, so their upper bounds are UINT8_MAX, not larger values
that would let a firmware-reported value above 255 pass validation
and then silently truncate on the byte store.

Fixes: 19e6af01bb36 ("net/bnxt: support get/set EEPROM")

Signed-off-by: Joseph Wong <joseph.wong at broadcom.com>
Signed-off-by: Farah Smith <farah.smith at broadcom.com>
Signed-off-by: Mohammad Shuab Siddique <mohammad-shuab.siddique at broadcom.com>
---
 .mailmap                     |  1 +
 drivers/net/bnxt/bnxt_hwrm.c | 16 +++++++++++++++-
 2 files changed, 16 insertions(+), 1 deletion(-)

diff --git a/.mailmap b/.mailmap
index 11c7d362bb..2c200b70d6 100644
--- a/.mailmap
+++ b/.mailmap
@@ -813,4 +813,5 @@ Joongi Kim <joongi at an.kaist.ac.kr>
 Jörg Thalheim <joerg at thalheim.io>
 Joseph Richard <joseph.richard at windriver.com>
+Joseph Wong <joseph.wong at broadcom.com>
 Josh Soref <jsoref at gmail.com>
 Joshua Hay <joshua.a.hay at intel.com>
diff --git a/drivers/net/bnxt/bnxt_hwrm.c b/drivers/net/bnxt/bnxt_hwrm.c
index 7a81773146..8160e266b5 100644
--- a/drivers/net/bnxt/bnxt_hwrm.c
+++ b/drivers/net/bnxt/bnxt_hwrm.c
@@ -5992,4 +5992,7 @@ int bnxt_hwrm_nvm_get_dir_info(struct bnxt *bp, uint32_t *entries,
 }
 
+#define BNXT_MAX_DIR_ENTRIES   UINT8_MAX
+#define BNXT_MAX_ENTRY_LENGTH  UINT8_MAX
+
 int bnxt_get_nvram_directory(struct bnxt *bp, uint32_t len, uint8_t *data)
 {
@@ -6003,8 +6006,19 @@ int bnxt_get_nvram_directory(struct bnxt *bp, uint32_t len, uint8_t *data)
 	struct hwrm_nvm_get_dir_entries_output *resp = bp->hwrm_cmd_resp_addr;
 
+	if (len < 2)
+		return -EINVAL;
+
 	rc = bnxt_hwrm_nvm_get_dir_info(bp, &dir_entries, &entry_length);
 	if (rc != 0)
 		return rc;
 
+	if (dir_entries == 0 || dir_entries > BNXT_MAX_DIR_ENTRIES ||
+	    entry_length == 0 || entry_length > BNXT_MAX_ENTRY_LENGTH) {
+		PMD_DRV_LOG_LINE(ERR,
+			"Invalid dir info: entries=%u length=%u",
+			dir_entries, entry_length);
+		return -EINVAL;
+	}
+
 	*data++ = dir_entries;
 	*data++ = entry_length;
@@ -6012,5 +6026,5 @@ int bnxt_get_nvram_directory(struct bnxt *bp, uint32_t len, uint8_t *data)
 	memset(data, 0xff, len);
 
-	buflen = dir_entries * entry_length;
+	buflen = (size_t)dir_entries * entry_length;
 	buf = rte_malloc("nvm_dir", buflen, 0);
 	if (buf == NULL)
-- 
2.56.1

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2026-12-03 12:52:44.984406961 +0000
+++ 0201-net-bnxt-fix-NVRAM-directory-integer-overflow.patch	2026-12-03 12:52:39.178938693 +0000
@@ -1 +1 @@
-From b2c95eacbcdbe03b7cdae7133b1f3faba300f99b Mon Sep 17 00:00:00 2001
+From c87d85bcddf8e78e2474623404373e3fde717118 Mon Sep 17 00:00:00 2001
@@ -5,0 +6,2 @@
+[ upstream commit b2c95eacbcdbe03b7cdae7133b1f3faba300f99b ]
+
@@ -18 +19,0 @@
-Cc: stable at dpdk.org
@@ -29 +30 @@
-index 67ff247224..b2fe3166d6 100644
+index 11c7d362bb..2c200b70d6 100644
@@ -32 +33 @@
-@@ -821,4 +821,5 @@ Joongi Kim <joongi at an.kaist.ac.kr>
+@@ -813,4 +813,5 @@ Joongi Kim <joongi at an.kaist.ac.kr>
@@ -39 +40 @@
-index 93fe754ced..df8cd14efb 100644
+index 7a81773146..8160e266b5 100644
@@ -42 +43 @@
-@@ -6016,4 +6016,7 @@ int bnxt_hwrm_nvm_get_dir_info(struct bnxt *bp, uint32_t *entries,
+@@ -5992,4 +5992,7 @@ int bnxt_hwrm_nvm_get_dir_info(struct bnxt *bp, uint32_t *entries,
@@ -50 +51 @@
-@@ -6027,8 +6030,19 @@ int bnxt_get_nvram_directory(struct bnxt *bp, uint32_t len, uint8_t *data)
+@@ -6003,8 +6006,19 @@ int bnxt_get_nvram_directory(struct bnxt *bp, uint32_t len, uint8_t *data)
@@ -70 +71 @@
-@@ -6036,5 +6050,5 @@ int bnxt_get_nvram_directory(struct bnxt *bp, uint32_t len, uint8_t *data)
+@@ -6012,5 +6026,5 @@ int bnxt_get_nvram_directory(struct bnxt *bp, uint32_t len, uint8_t *data)



More information about the stable mailing list