patch 'common/cnxk: check Tx scheduler queue allocation bounds' has been queued to stable release 24.11.9

luca.boccassi at gmail.com luca.boccassi at gmail.com
Mon Nov 16 23:51:41 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 11/18/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/01be62052f624955a37e4385849606e8beee1c72

Thanks.

Luca Boccassi

---
>From 01be62052f624955a37e4385849606e8beee1c72 Mon Sep 17 00:00:00 2001
From: Aarnav JP <ajp at marvell.com>
Date: Mon, 2 Nov 2026 17:51:50 +0530
Subject: [PATCH] common/cnxk: check Tx scheduler queue allocation bounds

[ upstream commit d1980381cbff645df65b711f93919e8c4a8b4440 ]

nix_tm_copy_rsp_to_nix() consumes the txsch alloc response verbatim.
The count rsp->schq[lvl] is not bounded to the 128-entry list, so a
large count over-reads schq_list[lvl][]; and the schq id is passed
to plt_bitmap_set() as the bit position without checking it against
NIX_TM_MAX_HW_TXSCHQ (2048). rte_bitmap_set() does not bound-check
pos, so an id >= 2048 writes outside the bitmap and corrupts memory.

Clamp the count to MAX_TXSCHQ_PER_FUNC and reject any id >=
NIX_TM_MAX_HW_TXSCHQ with -EINVAL, propagating the error out of
nix_tm_alloc_txschq() so setup fails cleanly. Applied to both the
discontiguous and contiguous lists.

Fixes: df405df95eeb ("common/cnxk: add NIX TM helper to alloc/free resource")

Signed-off-by: Aarnav JP <ajp at marvell.com>
---
 drivers/common/cnxk/roc_nix_priv.h   |  2 +-
 drivers/common/cnxk/roc_nix_tm.c     | 37 ++++++++++++++++++++++------
 drivers/common/cnxk/roc_nix_tm_ops.c |  8 ++++--
 3 files changed, 36 insertions(+), 11 deletions(-)

diff --git a/drivers/common/cnxk/roc_nix_priv.h b/drivers/common/cnxk/roc_nix_priv.h
index eb64608885..2d561a4146 100644
--- a/drivers/common/cnxk/roc_nix_priv.h
+++ b/drivers/common/cnxk/roc_nix_priv.h
@@ -400,7 +400,7 @@ int nix_tm_alloc_txschq(struct nix *nix, enum roc_nix_tm_tree tree);
 int nix_tm_assign_resources(struct nix *nix, enum roc_nix_tm_tree tree);
 int nix_tm_release_resources(struct nix *nix, uint8_t hw_lvl, bool contig,
 			     bool above_thresh);
-void nix_tm_copy_rsp_to_nix(struct nix *nix, struct nix_txsch_alloc_rsp *rsp);
+int nix_tm_copy_rsp_to_nix(struct nix *nix, struct nix_txsch_alloc_rsp *rsp);
 
 int nix_tm_txsch_reg_config(struct nix *nix, enum roc_nix_tm_tree tree);
 int nix_tm_update_parent_info(struct nix *nix, enum roc_nix_tm_tree tree);
diff --git a/drivers/common/cnxk/roc_nix_tm.c b/drivers/common/cnxk/roc_nix_tm.c
index abfe80978b..c2e4316b12 100644
--- a/drivers/common/cnxk/roc_nix_tm.c
+++ b/drivers/common/cnxk/roc_nix_tm.c
@@ -1483,21 +1483,40 @@ nix_tm_assign_resources(struct nix *nix, enum roc_nix_tm_tree tree)
 	return 0;
 }
 
-void
+int
 nix_tm_copy_rsp_to_nix(struct nix *nix, struct nix_txsch_alloc_rsp *rsp)
 {
 	uint8_t lvl;
 	uint16_t i;
 
 	for (lvl = 0; lvl < NIX_TXSCH_LVL_CNT; lvl++) {
-		for (i = 0; i < rsp->schq[lvl]; i++)
-			plt_bitmap_set(nix->schq_bmp[lvl],
-				       rsp->schq_list[lvl][i]);
 
-		for (i = 0; i < rsp->schq_contig[lvl]; i++)
-			plt_bitmap_set(nix->schq_contig_bmp[lvl],
-				       rsp->schq_contig_list[lvl][i]);
+		uint16_t cnt = PLT_MIN(rsp->schq[lvl], (uint16_t)MAX_TXSCHQ_PER_FUNC);
+
+		for (i = 0; i < cnt; i++) {
+			uint16_t id = rsp->schq_list[lvl][i];
+
+			if (id >= NIX_TM_MAX_HW_TXSCHQ) {
+				plt_err("Invalid schq %u for lvl %u in alloc rsp", id, lvl);
+				return -EINVAL;
+			}
+			plt_bitmap_set(nix->schq_bmp[lvl], id);
+		}
+
+		cnt = PLT_MIN(rsp->schq_contig[lvl], (uint16_t)MAX_TXSCHQ_PER_FUNC);
+
+		for (i = 0; i < cnt; i++) {
+			uint16_t id = rsp->schq_contig_list[lvl][i];
+
+			if (id >= NIX_TM_MAX_HW_TXSCHQ) {
+				plt_err("Invalid contig schq %u for lvl %u in alloc rsp", id, lvl);
+				return -EINVAL;
+			}
+			plt_bitmap_set(nix->schq_contig_bmp[lvl], id);
+		}
 	}
+
+	return 0;
 }
 
 int
@@ -1563,8 +1582,10 @@ nix_tm_alloc_txschq(struct nix *nix, enum roc_nix_tm_tree tree)
 			goto alloc_err;
 		}
 
-		nix_tm_copy_rsp_to_nix(nix, rsp);
+		rc = nix_tm_copy_rsp_to_nix(nix, rsp);
 		mbox_put(mbox);
+		if (rc)
+			goto alloc_err;
 	} while (pend);
 
 	nix->tm_link_cfg_lvl = rsp->link_cfg_lvl;
diff --git a/drivers/common/cnxk/roc_nix_tm_ops.c b/drivers/common/cnxk/roc_nix_tm_ops.c
index c5dfdb0122..877265ab05 100644
--- a/drivers/common/cnxk/roc_nix_tm_ops.c
+++ b/drivers/common/cnxk/roc_nix_tm_ops.c
@@ -772,8 +772,10 @@ roc_nix_tm_prealloc_res(struct roc_nix *roc_nix, uint8_t lvl,
 			return rc;
 		}
 
-		nix_tm_copy_rsp_to_nix(nix, rsp);
+		rc = nix_tm_copy_rsp_to_nix(nix, rsp);
 		mbox_put(mbox);
+		if (rc)
+			return rc;
 	}
 
 	/* Preallocate contiguous */
@@ -791,8 +793,10 @@ roc_nix_tm_prealloc_res(struct roc_nix *roc_nix, uint8_t lvl,
 			return rc;
 		}
 
-		nix_tm_copy_rsp_to_nix(nix, rsp);
+		rc = nix_tm_copy_rsp_to_nix(nix, rsp);
 		mbox_put(mbox);
+		if (rc)
+			return rc;
 	}
 
 	/* Save thresholds */
-- 
2.47.3

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2026-11-16 22:52:17.596338282 +0000
+++ 0027-common-cnxk-check-Tx-scheduler-queue-allocation-boun.patch	2026-11-16 22:52:16.456232636 +0000
@@ -1 +1 @@
-From d1980381cbff645df65b711f93919e8c4a8b4440 Mon Sep 17 00:00:00 2001
+From 01be62052f624955a37e4385849606e8beee1c72 Mon Sep 17 00:00:00 2001
@@ -5,0 +6,2 @@
+[ upstream commit d1980381cbff645df65b711f93919e8c4a8b4440 ]
+
@@ -19 +20,0 @@
-Cc: stable at dpdk.org
@@ -29 +30 @@
-index d4b3c7c1af..9779b336b0 100644
+index eb64608885..2d561a4146 100644
@@ -32 +33 @@
-@@ -421,7 +421,7 @@ int nix_tm_alloc_txschq(struct nix *nix, enum roc_nix_tm_tree tree);
+@@ -400,7 +400,7 @@ int nix_tm_alloc_txschq(struct nix *nix, enum roc_nix_tm_tree tree);
@@ -42 +43 @@
-index 76c0f01884..2f38b042f9 100644
+index abfe80978b..c2e4316b12 100644
@@ -106 +107 @@
-index 230e9b72f6..1086f471e6 100644
+index c5dfdb0122..877265ab05 100644
@@ -109 +110 @@
-@@ -778,8 +778,10 @@ roc_nix_tm_prealloc_res(struct roc_nix *roc_nix, uint8_t lvl,
+@@ -772,8 +772,10 @@ roc_nix_tm_prealloc_res(struct roc_nix *roc_nix, uint8_t lvl,
@@ -121 +122 @@
-@@ -797,8 +799,10 @@ roc_nix_tm_prealloc_res(struct roc_nix *roc_nix, uint8_t lvl,
+@@ -791,8 +793,10 @@ roc_nix_tm_prealloc_res(struct roc_nix *roc_nix, uint8_t lvl,


More information about the stable mailing list