patch 'common/cnxk: check Tx scheduler queue allocation bounds' has been queued to stable release 25.11.5
Kevin Traynor
ktraynor at redhat.com
Thu Dec 3 14:05:18 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/3018e7e19f7ad886c699ccfb1bfa1cff6ac67c7f
Thanks.
Kevin
---
>From 3018e7e19f7ad886c699ccfb1bfa1cff6ac67c7f 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 d4b3c7c1af..9779b336b0 100644
--- a/drivers/common/cnxk/roc_nix_priv.h
+++ b/drivers/common/cnxk/roc_nix_priv.h
@@ -422,5 +422,5 @@ 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);
diff --git a/drivers/common/cnxk/roc_nix_tm.c b/drivers/common/cnxk/roc_nix_tm.c
index 76c0f01884..2f38b042f9 100644
--- a/drivers/common/cnxk/roc_nix_tm.c
+++ b/drivers/common/cnxk/roc_nix_tm.c
@@ -1484,5 +1484,5 @@ nix_tm_assign_resources(struct nix *nix, enum roc_nix_tm_tree tree)
}
-void
+int
nix_tm_copy_rsp_to_nix(struct nix *nix, struct nix_txsch_alloc_rsp *rsp)
{
@@ -1491,12 +1491,31 @@ nix_tm_copy_rsp_to_nix(struct nix *nix, struct nix_txsch_alloc_rsp *rsp)
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;
}
@@ -1564,6 +1583,8 @@ nix_tm_alloc_txschq(struct nix *nix, enum roc_nix_tm_tree tree)
}
- 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);
diff --git a/drivers/common/cnxk/roc_nix_tm_ops.c b/drivers/common/cnxk/roc_nix_tm_ops.c
index 230e9b72f6..1086f471e6 100644
--- a/drivers/common/cnxk/roc_nix_tm_ops.c
+++ b/drivers/common/cnxk/roc_nix_tm_ops.c
@@ -779,6 +779,8 @@ roc_nix_tm_prealloc_res(struct roc_nix *roc_nix, uint8_t lvl,
}
- nix_tm_copy_rsp_to_nix(nix, rsp);
+ rc = nix_tm_copy_rsp_to_nix(nix, rsp);
mbox_put(mbox);
+ if (rc)
+ return rc;
}
@@ -798,6 +800,8 @@ roc_nix_tm_prealloc_res(struct roc_nix *roc_nix, uint8_t lvl,
}
- nix_tm_copy_rsp_to_nix(nix, rsp);
+ rc = nix_tm_copy_rsp_to_nix(nix, rsp);
mbox_put(mbox);
+ if (rc)
+ return rc;
}
--
2.56.1
---
Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- - 2026-12-03 12:52:50.277982640 +0000
+++ 0392-common-cnxk-check-Tx-scheduler-queue-allocation-boun.patch 2026-12-03 12:52:39.299938789 +0000
@@ -1 +1 @@
-From d1980381cbff645df65b711f93919e8c4a8b4440 Mon Sep 17 00:00:00 2001
+From 3018e7e19f7ad886c699ccfb1bfa1cff6ac67c7f Mon Sep 17 00:00:00 2001
@@ -5,0 +6,2 @@
+[ upstream commit d1980381cbff645df65b711f93919e8c4a8b4440 ]
+
@@ -19 +20,0 @@
-Cc: stable at dpdk.org
More information about the stable
mailing list