From: Robin Jarry <rjarry@redhat.com>
To: dev@dpdk.org
Cc: Robin Jarry <rjarry@redhat.com>,
stable@dpdk.org, Ciara Power <ciara.power@intel.com>,
Bruce Richardson <bruce.richardson@intel.com>,
Keith Wiles <keith.wiles@intel.com>
Subject: [PATCH] telemetry: reset data before passing it to callback
Date: Tue, 7 Feb 2023 19:45:20 +0100 [thread overview]
Message-ID: <20230207184520.1238366-1-rjarry@redhat.com> (raw)
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
next reply other threads:[~2023-02-07 18:45 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-07 18:45 Robin Jarry [this message]
2023-02-08 9:03 ` Bruce Richardson
2023-02-08 12:32 ` Robin Jarry
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230207184520.1238366-1-rjarry@redhat.com \
--to=rjarry@redhat.com \
--cc=bruce.richardson@intel.com \
--cc=ciara.power@intel.com \
--cc=dev@dpdk.org \
--cc=keith.wiles@intel.com \
--cc=stable@dpdk.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).