patch 'dmadev: validate telemetry parameters' has been queued to stable release 25.11.3

Kevin Traynor ktraynor at redhat.com
Tue Jul 28 17:55:42 CEST 2026


Hi,

FYI, your patch has been queued to stable release 25.11.3

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 08/01/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/7eff9b605cc185cfb9252c3361180d3ba63d3179

Thanks.

Kevin

---
>From 7eff9b605cc185cfb9252c3361180d3ba63d3179 Mon Sep 17 00:00:00 2001
From: Stephen Hemminger <stephen at networkplumber.org>
Date: Fri, 5 Jun 2026 13:51:00 -0700
Subject: [PATCH] dmadev: validate telemetry parameters

[ upstream commit 58176f92b41c1b2b10b563fd9c0e2e425b0a070b ]

Tighten parsing of the dmadev telemetry device and vchan parameters:
reject non-numeric and out-of-range ids through a bounded helper rather
than narrowing strtoul()'s result to int and leaning on the downstream
int16_t/uint16_t API to revalidate. This also drops the thread-unsafe
strtok() in the stats handler.

Fixes: 39b5ab60df30 ("dmadev: add telemetry")

Signed-off-by: Stephen Hemminger <stephen at networkplumber.org>
Acked-by: Chengwen Feng <fengchengwen at huawei.com>
Acked-by: Bruce Richardson <bruce.richardson at intel.com>
---
 lib/dmadev/rte_dmadev.c | 44 ++++++++++++++++++++++++++++-------------
 1 file changed, 30 insertions(+), 14 deletions(-)

diff --git a/lib/dmadev/rte_dmadev.c b/lib/dmadev/rte_dmadev.c
index b75b4f9bd1..822bb7c89f 100644
--- a/lib/dmadev/rte_dmadev.c
+++ b/lib/dmadev/rte_dmadev.c
@@ -5,4 +5,5 @@
 
 #include <ctype.h>
+#include <errno.h>
 #include <inttypes.h>
 #include <stdlib.h>
@@ -1158,4 +1159,23 @@ dmadev_handle_dev_list(const char *cmd __rte_unused,
 }
 
+/* Parse an unsigned integer telemetry parameter, returning the value or
+ * -EINVAL.  'max' must be <= INT_MAX.
+ */
+static int
+dmadev_parse_uint(const char *str, char **end, unsigned long max)
+{
+	unsigned long val;
+
+	if (str == NULL || !isdigit((unsigned char)*str))
+		return -EINVAL;
+
+	errno = 0;
+	val = strtoul(str, end, 0);
+	if (errno != 0 || val > max)
+		return -EINVAL;
+
+	return (int)val;
+}
+
 #define ADD_CAPA(td, dc, c) rte_tel_data_add_dict_int(td, dma_capability_name(c), !!(dc & c))
 
@@ -1170,8 +1190,7 @@ dmadev_handle_dev_info(const char *cmd __rte_unused,
 	char *end_param;
 
-	if (params == NULL || strlen(params) == 0 || !isdigit(*params))
+	dev_id = dmadev_parse_uint(params, &end_param, INT16_MAX);
+	if (dev_id < 0)
 		return -EINVAL;
-
-	dev_id = strtoul(params, &end_param, 0);
 	if (*end_param != '\0')
 		RTE_DMA_LOG(WARNING, "Extra parameters passed to dmadev telemetry command, ignoring");
@@ -1228,11 +1247,9 @@ dmadev_handle_dev_stats(const char *cmd __rte_unused,
 	int dev_id, ret, vchan_id;
 	char *end_param;
-	const char *vchan_param;
 
-	if (params == NULL || strlen(params) == 0 || !isdigit(*params))
+	dev_id = dmadev_parse_uint(params, &end_param, INT16_MAX);
+	if (dev_id < 0)
 		return -EINVAL;
 
-	dev_id = strtoul(params, &end_param, 0);
-
 	/* Function info_get validates dev_id so we don't need to. */
 	ret = rte_dma_info_get(dev_id, &dma_info);
@@ -1246,9 +1263,9 @@ dmadev_handle_dev_stats(const char *cmd __rte_unused,
 		vchan_id = 0;
 	else {
-		vchan_param = strtok(end_param, ",");
-		if (!vchan_param || strlen(vchan_param) == 0 || !isdigit(*vchan_param))
+		if (*end_param != ',')
+			return -EINVAL;
+		vchan_id = dmadev_parse_uint(end_param + 1, &end_param, UINT16_MAX);
+		if (vchan_id < 0)
 			return -EINVAL;
-
-		vchan_id = strtoul(vchan_param, &end_param, 0);
 	}
 	if (*end_param != '\0')
@@ -1277,8 +1294,7 @@ dmadev_handle_dev_dump(const char *cmd __rte_unused,
 	FILE *f;
 
-	if (params == NULL || strlen(params) == 0 || !isdigit(*params))
+	dev_id = dmadev_parse_uint(params, &end_param, INT16_MAX);
+	if (dev_id < 0)
 		return -EINVAL;
-
-	dev_id = strtoul(params, &end_param, 0);
 	if (*end_param != '\0')
 		RTE_DMA_LOG(WARNING, "Extra parameters passed to dmadev telemetry command, ignoring");
-- 
2.55.0

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2026-07-28 16:54:51.188052307 +0100
+++ 0012-dmadev-validate-telemetry-parameters.patch	2026-07-28 16:54:50.756458323 +0100
@@ -1 +1 @@
-From 58176f92b41c1b2b10b563fd9c0e2e425b0a070b Mon Sep 17 00:00:00 2001
+From 7eff9b605cc185cfb9252c3361180d3ba63d3179 Mon Sep 17 00:00:00 2001
@@ -5,0 +6,2 @@
+[ upstream commit 58176f92b41c1b2b10b563fd9c0e2e425b0a070b ]
+
@@ -13 +14,0 @@
-Cc: stable at dpdk.org



More information about the stable mailing list