From: Stephen Hemminger <stephen@networkplumber.org>
To: dev@dpdk.org
Cc: Stephen Hemminger <stephen@networkplumber.org>,
stable@dpdk.org,
Kishore Padmanabha <kishore.padmanabha@broadcom.com>,
Ajit Khaparde <ajit.khaparde@broadcom.com>,
Somnath Kotur <somnath.kotur@broadcom.com>,
Michael Wildt <michael.wildt@broadcom.com>,
Randy Schacher <stuart.schacher@broadcom.com>
Subject: [RFC] net/bnxt: fix buffer overflow in TF set message helpers
Date: Tue, 27 Oct 2026 20:53:53 -0700 [thread overview]
Message-ID: <20261028035353.2273737-1-stephen@networkplumber.org> (raw)
LTO build with -Werror reports stack overflows in tf_msg.c:
In function 'tf_global_cfg_set':
rte_memcpy.h:91:9: error: writing 16 bytes into a region of size 8
tf_msg.c:1574:45: note: at offset 48 into destination object 'req'
of size 56
In function 'tf_msg_set_if_tbl_entry':
rte_memcpy.h:105:9: error: writing 32 bytes into a region of size 0
tf_msg.c:1813:41: note: at offset 136 into destination object 'req'
of size 128
tf_msg_set_global_cfg() limits config_sz_in_bytes to 16, but
req.data and req.mask are each 8 bytes. A config larger than 8 bytes
overruns data into mask, and the mask copy runs off the end of req.
tf_msg_set_if_tbl_entry() has no check at all. data_sz_in_bytes is a
uint16_t copied into the 88 byte req.data. The ULP mapper fills it
from a blob of up to 128 bytes.
Check both against sizeof() of the destination, as the matching get
functions already do.
Fixes: 98487d729b4a ("net/bnxt: cleanup and refactor session management")
Cc: stable@dpdk.org
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
drivers/net/bnxt/tf_core/tf_msg.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/net/bnxt/tf_core/tf_msg.c b/drivers/net/bnxt/tf_core/tf_msg.c
index aab8d05d81..ab03afaabd 100644
--- a/drivers/net/bnxt/tf_core/tf_msg.c
+++ b/drivers/net/bnxt/tf_core/tf_msg.c
@@ -23,7 +23,6 @@
* means we have to manually sync hwrm with these defines if the
* tf.yaml changes.
*/
-#define TF_MSG_SET_GLOBAL_CFG_DATA_SIZE 16
#define TF_MSG_EM_INSERT_KEY_SIZE 64
#define TF_MSG_EM_INSERT_RECORD_SIZE 96
#define TF_MSG_TBL_TYPE_SET_DATA_SIZE 88
@@ -1618,7 +1617,7 @@ tf_msg_set_global_cfg(struct tf *tfp,
req.offset = tfp_cpu_to_le_32(params->offset);
/* Check for data size conformity */
- if (params->config_sz_in_bytes > TF_MSG_SET_GLOBAL_CFG_DATA_SIZE) {
+ if (params->config_sz_in_bytes > sizeof(req.data)) {
rc = -EINVAL;
TFP_DRV_LOG(ERR,
"%s: Invalid parameters for msg type, rc:%s\n",
@@ -1816,6 +1815,9 @@ tf_msg_set_if_tbl_entry(struct tf *tfp,
struct tf_dev_info *dev;
struct tf_session *tfs;
+ if (params->data_sz_in_bytes > sizeof(req.data))
+ return -EINVAL;
+
/* Retrieve the session information */
rc = tf_session_get_session(tfp, &tfs);
if (rc) {
--
2.53.0
next reply other threads:[~2026-10-28 3:54 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-28 3:53 Stephen Hemminger [this message]
2026-10-28 15:40 ` [RFC] net/bnxt: fix buffer overflow in TF set message helpers Kishore Padmanabha
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=20261028035353.2273737-1-stephen@networkplumber.org \
--to=stephen@networkplumber.org \
--cc=ajit.khaparde@broadcom.com \
--cc=dev@dpdk.org \
--cc=kishore.padmanabha@broadcom.com \
--cc=michael.wildt@broadcom.com \
--cc=somnath.kotur@broadcom.com \
--cc=stable@dpdk.org \
--cc=stuart.schacher@broadcom.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