patch 'telemetry: fix thread-unsafe command parsing' has been queued to stable release 24.11.7
luca.boccassi at gmail.com
luca.boccassi at gmail.com
Thu Jun 11 15:20:42 CEST 2026
Hi,
FYI, your patch has been queued to stable release 24.11.7
Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 06/13/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/8440bba8eae299af3eb03899b22c0d601b8e046b
Thanks.
Luca Boccassi
---
>From 8440bba8eae299af3eb03899b22c0d601b8e046b Mon Sep 17 00:00:00 2001
From: Stephen Hemminger <stephen at networkplumber.org>
Date: Fri, 5 Jun 2026 13:50:58 -0700
Subject: [PATCH] telemetry: fix thread-unsafe command parsing
[ upstream commit fdf75c91a68140c7e2ca287d4c6a708960308e51 ]
The telemetry client_handler() runs in a detached thread per connection,
and up to MAX_CONNECTIONS instances can run concurrently.
The function strtok() keeps parser state in a static variable
shared across all threads, so concurrent clients corrupt each other's
command parsing. Use strtok_r() with a local saveptr.
Fixes: 6dd571fd07c3 ("telemetry: introduce new functionality")
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/telemetry/telemetry.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/lib/telemetry/telemetry.c b/lib/telemetry/telemetry.c
index 8fe35f362b..2d729d4c5c 100644
--- a/lib/telemetry/telemetry.c
+++ b/lib/telemetry/telemetry.c
@@ -412,8 +412,9 @@ client_handler(void *sock_id)
int bytes = read(s, buffer, sizeof(buffer) - 1);
while (bytes > 0) {
buffer[bytes] = 0;
- const char *cmd = strtok(buffer, ",");
- const char *param = strtok(NULL, "\0");
+ char *saveptr = NULL;
+ const char *cmd = strtok_r(buffer, ",", &saveptr);
+ const char *param = strtok_r(NULL, "\0", &saveptr);
struct cmd_callback cb = {.fn = unknown_command};
int i;
--
2.47.3
---
Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- - 2026-06-11 14:20:04.989625923 +0100
+++ 0093-telemetry-fix-thread-unsafe-command-parsing.patch 2026-06-11 14:20:01.338748996 +0100
@@ -1 +1 @@
-From fdf75c91a68140c7e2ca287d4c6a708960308e51 Mon Sep 17 00:00:00 2001
+From 8440bba8eae299af3eb03899b22c0d601b8e046b Mon Sep 17 00:00:00 2001
@@ -5,0 +6,2 @@
+[ upstream commit fdf75c91a68140c7e2ca287d4c6a708960308e51 ]
+
@@ -13 +14,0 @@
-Cc: stable at dpdk.org
@@ -23 +24 @@
-index b109d076d4..e591c1e283 100644
+index 8fe35f362b..2d729d4c5c 100644
@@ -26 +27 @@
-@@ -415,8 +415,9 @@ client_handler(void *sock_id)
+@@ -412,8 +412,9 @@ client_handler(void *sock_id)
More information about the stable
mailing list