patches for DPDK stable branches
 help / color / mirror / Atom feed
* [PATCH] telemetry: reset data before passing it to callback
@ 2023-02-07 18:45 Robin Jarry
  2023-02-08  9:03 ` Bruce Richardson
  0 siblings, 1 reply; 3+ messages in thread
From: Robin Jarry @ 2023-02-07 18:45 UTC (permalink / raw)
  To: dev; +Cc: Robin Jarry, stable, Ciara Power, Bruce Richardson, Keith Wiles

If a telemetry endpoint callback returns 0 without modifying the data
object, output_json() may be called with undefined contents in data.
This can cause crashes and/or worse (double free, etc.).

Reset data before passing it to the endpoint callbacks.

Fixes: 6dd571fd07c3 ("telemetry: introduce new functionality")
Cc: stable@dpdk.org

Signed-off-by: Robin Jarry <rjarry@redhat.com>
---
 lib/telemetry/telemetry.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/lib/telemetry/telemetry.c b/lib/telemetry/telemetry.c
index 655191bcf17f..6303429bb0c9 100644
--- a/lib/telemetry/telemetry.c
+++ b/lib/telemetry/telemetry.c
@@ -335,6 +335,8 @@ perform_command(telemetry_cb fn, const char *cmd, const char *param, int s)
 {
 	struct rte_tel_data data;
 
+	memset(&data, 0, sizeof(data));
+
 	int ret = fn(cmd, param, &data);
 	if (ret < 0) {
 		char out_buf[MAX_CMD_LEN + 10];
-- 
2.39.1


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-02-08 12:33 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-07 18:45 [PATCH] telemetry: reset data before passing it to callback Robin Jarry
2023-02-08  9:03 ` Bruce Richardson
2023-02-08 12:32   ` Robin Jarry

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).