From: Manish Kurup <manish.kurup@broadcom.com>
To: dev@dpdk.org
Cc: kishore.padmanabha@broadcom.com,
Joseph Wong <joseph.wong@broadcom.com>,
stable@dpdk.org
Subject: [PATCH] net/bnxt: add bounds checks for FW-supplied IDs
Date: Mon, 5 Oct 2026 18:50:34 -0500 [thread overview]
Message-ID: <20261005235034.26923-1-manish.kurup@broadcom.com> (raw)
From: Joseph Wong <joseph.wong@broadcom.com>
In ulp_port_db_port_update(), firmware supplies IDs (drv_func_id,
vf_func_id, phy_port_id) which are used as array indices. Add
strict bounds checking to prevent out of bounds memory accesses.
Fixes: ad9eed0248ad ("net/bnxt: support flow template for Thor")
Fixes: 1993b267dbcb ("net/bnxt: cleanup ULP parser and mapper")
Fixes: ddaf0afae48a ("net/bnxt: refactor ULP mapper")
Cc: stable@dpdk.org
Signed-off-by: Joseph Wong <joseph.wong@broadcom.com>
Signed-off-by: Manish Kurup <manish.kurup@broadcom.com>
---
drivers/net/bnxt/tf_ulp/ulp_port_db.c | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/drivers/net/bnxt/tf_ulp/ulp_port_db.c b/drivers/net/bnxt/tf_ulp/ulp_port_db.c
index 6907771725..aad66fd8ab 100644
--- a/drivers/net/bnxt/tf_ulp/ulp_port_db.c
+++ b/drivers/net/bnxt/tf_ulp/ulp_port_db.c
@@ -159,6 +159,11 @@ int32_t ulp_port_db_port_update(struct bnxt_ulp_context *ulp_ctxt,
intf->drv_func_id = bnxt_pmd_get_fw_func_id(port_id,
BNXT_ULP_INTF_TYPE_INVALID);
+ if (intf->drv_func_id >= BNXT_PORT_DB_MAX_FUNC) {
+ BNXT_DRV_DBG(ERR, "Invalid drv_func_id %d", intf->drv_func_id);
+ return -EINVAL;
+ }
+
func = &port_db->ulp_func_id_tbl[intf->drv_func_id];
if (!func->func_valid) {
func->func_svif = bnxt_pmd_get_svif(port_id, true,
@@ -180,6 +185,11 @@ int32_t ulp_port_db_port_update(struct bnxt_ulp_context *ulp_ctxt,
intf->vf_func_id =
bnxt_pmd_get_fw_func_id(port_id, BNXT_ULP_INTF_TYPE_VF_REP);
+ if (intf->vf_func_id >= BNXT_PORT_DB_MAX_FUNC) {
+ BNXT_DRV_DBG(ERR, "Invalid vf_func_id %d", intf->vf_func_id);
+ return -EINVAL;
+ }
+
func = &port_db->ulp_func_id_tbl[intf->vf_func_id];
func->func_svif =
bnxt_pmd_get_svif(port_id, true, BNXT_ULP_INTF_TYPE_VF_REP);
@@ -206,6 +216,11 @@ int32_t ulp_port_db_port_update(struct bnxt_ulp_context *ulp_ctxt,
bnxt_pmd_get_iface_mac(port_id, intf->type, func->func_mac,
func->func_parent_mac);
+ if (func->phy_port_id >= port_db->phy_port_cnt) {
+ BNXT_DRV_DBG(ERR, "Invalid phy_port_id %d", func->phy_port_id);
+ return -EINVAL;
+ }
+
port_data = &port_db->phy_port_list[func->phy_port_id];
if (!port_data->port_valid) {
port_data->port_svif =
--
2.31.1
reply other threads:[~2026-10-05 23:50 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20261005235034.26923-1-manish.kurup@broadcom.com \
--to=manish.kurup@broadcom.com \
--cc=dev@dpdk.org \
--cc=joseph.wong@broadcom.com \
--cc=kishore.padmanabha@broadcom.com \
--cc=stable@dpdk.org \
/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