patch 'event/cnxk: fix out-of-bounds access' has been queued to stable release 25.11.5
Kevin Traynor
ktraynor at redhat.com
Thu Dec 3 13:58:52 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/b4d6674985bccf0b6895cdf682953cb516427a50
Thanks.
Kevin
---
>From b4d6674985bccf0b6895cdf682953cb516427a50 Mon Sep 17 00:00:00 2001
From: Pavan Nikhilesh <pbhagavatula at marvell.com>
Date: Wed, 9 Sep 2026 07:30:11 +0530
Subject: [PATCH] event/cnxk: fix out-of-bounds access
[ upstream commit e80411aecd4b2182894101358fb5ee9da127e380 ]
The devargs parsing helpers wrote to the parameter structure for as
long as tokens remained, so supplying more tokens than expected
overflowed the fixed-size structures. Bound each loop to the
structure size and reject input that contains extra tokens.
Likewise, cnxk_sso_xstats_get() and cnxk_sso_xstats_reset() indexed
the xstats array with caller-supplied IDs that were never validated,
so out-of-range IDs could access past the array. Skip any ID that
falls outside the valid range.
cnxk_tim_add_entry_tmo_hwwqe() used cnt as a count of LMT lines, not
timers, when computing the remainder, so nb_timers >= 8 wrote past
the LMT line. Convert cnt to a timer count first.
Fixes: 38c2e3240ba8 ("event/cnxk: add option to control SSO HWGRP QoS")
Fixes: 20345cbda6d3 ("event/cnxk: support WQE stashing")
Fixes: b5a52c9d97e2 ("event/cnxk: add event port and queue xstats")
Fixes: 8a3d58c189fd ("event/cnxk: add option to control timer adapters")
Fixes: 822d4ef519f6 ("event/cnxk: add CN20K timer adapter")
Signed-off-by: Pavan Nikhilesh <pbhagavatula at marvell.com>
---
drivers/event/cnxk/cnxk_eventdev.c | 8 +--
drivers/event/cnxk/cnxk_eventdev_stats.c | 64 +++++++++++++++++-------
drivers/event/cnxk/cnxk_tim_evdev.c | 4 +-
drivers/event/cnxk/cnxk_tim_worker.h | 1 +
4 files changed, 52 insertions(+), 25 deletions(-)
diff --git a/drivers/event/cnxk/cnxk_eventdev.c b/drivers/event/cnxk/cnxk_eventdev.c
index 4aa16f9026..1fb4466161 100644
--- a/drivers/event/cnxk/cnxk_eventdev.c
+++ b/drivers/event/cnxk/cnxk_eventdev.c
@@ -489,5 +489,5 @@ parse_queue_param(char *value, void *opaque)
return;
- while (tok != NULL) {
+ while (tok != NULL && val < (&queue_qos.iaq_prcnt + 1)) {
*val = atoi(tok);
tok = strtok(NULL, "-");
@@ -495,5 +495,5 @@ parse_queue_param(char *value, void *opaque)
}
- if (val != (&queue_qos.iaq_prcnt + 1)) {
+ if (tok != NULL || val != (&queue_qos.iaq_prcnt + 1)) {
plt_err("Invalid QoS parameter expected [Qx-TAQ-IAQ]");
return;
@@ -526,5 +526,5 @@ parse_stash_param(char *value, void *opaque)
val = (uint16_t *)&queue_stash;
- while (tok != NULL) {
+ while (tok != NULL && val < (&queue_stash.stash_length + 1)) {
*val = atoi(tok);
tok = strtok(NULL, "|");
@@ -532,5 +532,5 @@ parse_stash_param(char *value, void *opaque)
}
- if (val != (&queue_stash.stash_length + 1)) {
+ if (tok != NULL || val != (&queue_stash.stash_length + 1)) {
plt_err("Invalid QoS parameter expected [Qx|stash_offset|stash_length]");
return;
diff --git a/drivers/event/cnxk/cnxk_eventdev_stats.c b/drivers/event/cnxk/cnxk_eventdev_stats.c
index 6dea91aedf..d88e6130b9 100644
--- a/drivers/event/cnxk/cnxk_eventdev_stats.c
+++ b/drivers/event/cnxk/cnxk_eventdev_stats.c
@@ -158,4 +158,6 @@ cnxk_sso_xstats_get(const struct rte_eventdev *event_dev,
for (i = 0; i < n && i < xstats_mode_count; i++) {
+ if (ids[i] < start_offset || (ids[i] - start_offset) >= xstats_mode_count)
+ goto invalid_value;
xstat = &xstats[ids[i] - start_offset];
value = *(uint64_t *)((char *)rsp + xstat->offset);
@@ -182,4 +184,5 @@ cnxk_sso_xstats_reset(struct rte_eventdev *event_dev,
struct roc_sso_hws_stats hws_stats;
uint32_t xstats_mode_count = 0;
+ int16_t first_id, last_id, id;
uint32_t start_offset = 0;
unsigned int i;
@@ -192,17 +195,15 @@ cnxk_sso_xstats_reset(struct rte_eventdev *event_dev,
return 0;
case RTE_EVENT_DEV_XSTATS_PORT:
- if (queue_port_id >= (signed int)dev->nb_event_ports)
+ if (queue_port_id >= (int16_t)dev->nb_event_ports)
goto invalid_value;
xstats_mode_count = CNXK_SSO_NUM_HWS_XSTATS;
xstats = sso_hws_xstats;
- rc = roc_sso_hws_stats_get(&dev->sso, queue_port_id,
- &hws_stats);
- if (rc < 0)
- goto invalid_value;
- rsp = &hws_stats;
+ /* Negative id requests a reset of all ports. */
+ first_id = (queue_port_id < 0) ? 0 : queue_port_id;
+ last_id = (queue_port_id < 0) ? (int16_t)dev->nb_event_ports - 1 : queue_port_id;
break;
case RTE_EVENT_DEV_XSTATS_QUEUE:
- if (queue_port_id >= (signed int)dev->nb_event_queues)
+ if (queue_port_id >= (int16_t)dev->nb_event_queues)
goto invalid_value;
@@ -210,10 +211,7 @@ cnxk_sso_xstats_reset(struct rte_eventdev *event_dev,
start_offset = CNXK_SSO_NUM_HWS_XSTATS;
xstats = sso_hwgrp_xstats;
-
- rc = roc_sso_hwgrp_stats_get(&dev->sso, queue_port_id,
- &hwgrp_stats);
- if (rc < 0)
- goto invalid_value;
- rsp = &hwgrp_stats;
+ /* Negative id requests a reset of all queues. */
+ first_id = (queue_port_id < 0) ? 0 : queue_port_id;
+ last_id = (queue_port_id < 0) ? (int16_t)dev->nb_event_queues - 1 : queue_port_id;
break;
default:
@@ -222,12 +220,40 @@ cnxk_sso_xstats_reset(struct rte_eventdev *event_dev,
};
- for (i = 0; i < n && i < xstats_mode_count; i++) {
- xstat = &xstats[ids[i] - start_offset];
- value = *(uint64_t *)((char *)rsp + xstat->offset);
- value = (value >> xstat->shift) & xstat->mask;
+ for (id = first_id; id <= last_id; id++) {
+ if (mode == RTE_EVENT_DEV_XSTATS_PORT) {
+ rc = roc_sso_hws_stats_get(&dev->sso, id, &hws_stats);
+ if (rc < 0)
+ goto invalid_value;
+ rsp = &hws_stats;
+ } else {
+ rc = roc_sso_hwgrp_stats_get(&dev->sso, id, &hwgrp_stats);
+ if (rc < 0)
+ goto invalid_value;
+ rsp = &hwgrp_stats;
+ }
- xstat->reset_snap[queue_port_id] = value;
+ if (ids == NULL) {
+ for (i = 0; i < xstats_mode_count; i++) {
+ xstat = &xstats[i];
+ value = *(uint64_t *)((char *)rsp + xstat->offset);
+ value = (value >> xstat->shift) & xstat->mask;
+
+ xstat->reset_snap[id] = value;
+ }
+ continue;
+ }
+
+ for (i = 0; i < n; i++) {
+ if (ids[i] < start_offset || (ids[i] - start_offset) >= xstats_mode_count)
+ goto invalid_value;
+ xstat = &xstats[ids[i] - start_offset];
+ value = *(uint64_t *)((char *)rsp + xstat->offset);
+ value = (value >> xstat->shift) & xstat->mask;
+
+ xstat->reset_snap[id] = value;
+ }
}
- return i;
+
+ return 0;
invalid_value:
return -EINVAL;
diff --git a/drivers/event/cnxk/cnxk_tim_evdev.c b/drivers/event/cnxk/cnxk_tim_evdev.c
index 8cdb8a72dd..bc1489d985 100644
--- a/drivers/event/cnxk/cnxk_tim_evdev.c
+++ b/drivers/event/cnxk/cnxk_tim_evdev.c
@@ -465,5 +465,5 @@ cnxk_tim_parse_ring_param(char *value, void *opaque)
return;
- while (tok != NULL) {
+ while (tok != NULL && val < (&ring_ctl.enable_stats + 1)) {
*val = atoi(tok);
tok = strtok(NULL, "-");
@@ -471,5 +471,5 @@ cnxk_tim_parse_ring_param(char *value, void *opaque)
}
- if (val != (&ring_ctl.enable_stats + 1)) {
+ if (tok != NULL || val != (&ring_ctl.enable_stats + 1)) {
plt_err("Invalid ring param expected [ring-chunk_sz-disable_npa-enable_stats]");
return;
diff --git a/drivers/event/cnxk/cnxk_tim_worker.h b/drivers/event/cnxk/cnxk_tim_worker.h
index 09f84091ab..a330538618 100644
--- a/drivers/event/cnxk/cnxk_tim_worker.h
+++ b/drivers/event/cnxk/cnxk_tim_worker.h
@@ -726,4 +726,5 @@ cnxk_tim_add_entry_tmo_hwwqe(struct cnxk_tim_ring *const tim_ring,
}
+ cnt *= CNXK_TIM_ENT_PER_LMT;
/* SIZEM1 is 0 */
pa = (tim_ring->tbase & ~0xFF) + TIM_LF_SCHED_TIMER0;
--
2.56.1
---
Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- - 2026-12-03 12:52:39.534954318 +0000
+++ 0006-event-cnxk-fix-out-of-bounds-access.patch 2026-12-03 12:52:39.015938563 +0000
@@ -1 +1 @@
-From e80411aecd4b2182894101358fb5ee9da127e380 Mon Sep 17 00:00:00 2001
+From b4d6674985bccf0b6895cdf682953cb516427a50 Mon Sep 17 00:00:00 2001
@@ -5,0 +6,2 @@
+[ upstream commit e80411aecd4b2182894101358fb5ee9da127e380 ]
+
@@ -25 +26,0 @@
-Cc: stable at dpdk.org
@@ -36 +37 @@
-index 41079af2a9..e3a3134264 100644
+index 4aa16f9026..1fb4466161 100644
@@ -169 +170 @@
-index 7541440877..44acd4ef51 100644
+index 8cdb8a72dd..bc1489d985 100644
@@ -172 +173 @@
-@@ -472,5 +472,5 @@ cnxk_tim_parse_ring_param(char *value, void *opaque)
+@@ -465,5 +465,5 @@ cnxk_tim_parse_ring_param(char *value, void *opaque)
@@ -179 +180 @@
-@@ -478,5 +478,5 @@ cnxk_tim_parse_ring_param(char *value, void *opaque)
+@@ -471,5 +471,5 @@ cnxk_tim_parse_ring_param(char *value, void *opaque)
@@ -187 +188 @@
-index 6a9099a23f..9e33ff58d6 100644
+index 09f84091ab..a330538618 100644
@@ -190 +191 @@
-@@ -727,4 +727,5 @@ cnxk_tim_add_entry_tmo_hwwqe(struct cnxk_tim_ring *const tim_ring,
+@@ -726,4 +726,5 @@ cnxk_tim_add_entry_tmo_hwwqe(struct cnxk_tim_ring *const tim_ring,
More information about the stable
mailing list