patches for DPDK stable branches
 help / color / mirror / Atom feed
* [dpdk-stable] [PATCH] telemetry: fix race in telemetry control thread creation
@ 2021-06-16  6:52 Alvin Zhang
  0 siblings, 0 replies; only message in thread
From: Alvin Zhang @ 2021-06-16  6:52 UTC (permalink / raw)
  To: christian.ehrhardt, LingliX.Chen; +Cc: Alvin Zhang, stable

From: Alvin Zhang <alvinzhx@intel.com>

Before calling thread returns from the function
"rte_ctrl_thread_create", the newly created thread may have ran
and exited for "thread_status" was 0.

This patch puts setting "thread_status" status before creating
new thread.

Fixes: 8877ac688b52 ("telemetry: introduce infrastructure")
Cc: stable@dpdk.org

Signed-off-by: Alvin Zhang <alvinzhx@intel.com>
---
 lib/librte_telemetry/rte_telemetry.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/librte_telemetry/rte_telemetry.c b/lib/librte_telemetry/rte_telemetry.c
index eb20cc6..98d5f91 100644
--- a/lib/librte_telemetry/rte_telemetry.c
+++ b/lib/librte_telemetry/rte_telemetry.c
@@ -1005,10 +1005,10 @@ struct json_data {
 	}
 	TAILQ_INIT(&static_telemetry->client_list_head);
 
+	static_telemetry->thread_status = 1;
 	ret = rte_ctrl_thread_create(&static_telemetry->thread_id,
 		telemetry_ctrl_thread, &attr, rte_telemetry_run_thread_func,
 		(void *)static_telemetry);
-	static_telemetry->thread_status = 1;
 
 	if (ret < 0) {
 		ret = rte_telemetry_cleanup();
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-06-16  6:52 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-16  6:52 [dpdk-stable] [PATCH] telemetry: fix race in telemetry control thread creation Alvin Zhang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).