From: Steven Rostedt <rostedt@goodmis.org>
To: linux-kernel@vger.kernel.org
Cc: Ingo Molnar <mingo@kernel.org>,
Andrew Morton <akpm@linux-foundation.org>,
stable@vger.kernel.org, Xiaoke Wang <xkernel.wang@foxmail.com>
Subject: [for-linus][PATCH 02/10] tracing/histogram: Fix a potential memory leak for kstrdup()
Date: Fri, 28 Jan 2022 11:18:04 -0500 [thread overview]
Message-ID: <20220128162343.618746472@goodmis.org> (raw)
In-Reply-To: 20220128161802.711119424@goodmis.org
From: Xiaoke Wang <xkernel.wang@foxmail.com>
kfree() is missing on an error path to free the memory allocated by
kstrdup():
p = param = kstrdup(data->params[i], GFP_KERNEL);
So it is better to free it via kfree(p).
Link: https://lkml.kernel.org/r/tencent_C52895FD37802832A3E5B272D05008866F0A@qq.com
Cc: stable@vger.kernel.org
Fixes: d380dcde9a07c ("tracing: Fix now invalid var_ref_vals assumption in trace action")
Signed-off-by: Xiaoke Wang <xkernel.wang@foxmail.com>
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
---
kernel/trace/trace_events_hist.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/kernel/trace/trace_events_hist.c b/kernel/trace/trace_events_hist.c
index 5e6a988a8a51..cd9610688ddc 100644
--- a/kernel/trace/trace_events_hist.c
+++ b/kernel/trace/trace_events_hist.c
@@ -3935,6 +3935,7 @@ static int trace_action_create(struct hist_trigger_data *hist_data,
var_ref_idx = find_var_ref_idx(hist_data, var_ref);
if (WARN_ON(var_ref_idx < 0)) {
+ kfree(p);
ret = var_ref_idx;
goto err;
}
--
2.33.0
next prev parent reply other threads:[~2022-01-28 16:23 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-01-28 16:18 [for-linus][PATCH 00/10] tracing: Fixes for 5.17-rc1 Steven Rostedt
2022-01-28 16:18 ` [for-linus][PATCH 01/10] ftrace: Have architectures opt-in for mcount build time sorting Steven Rostedt
2022-01-28 16:18 ` Steven Rostedt [this message]
2022-01-28 16:18 ` [for-linus][PATCH 03/10] tracing: Avoid -Warray-bounds warning for __rel_loc macro Steven Rostedt
2022-01-28 16:18 ` [for-linus][PATCH 04/10] tracing/perf: " Steven Rostedt
2022-01-28 16:18 ` [for-linus][PATCH 05/10] rtla: Make doc build optional Steven Rostedt
2022-01-28 16:18 ` [for-linus][PATCH 06/10] tools/tracing: Update Makefile to build rtla Steven Rostedt
2022-01-28 16:18 ` [for-linus][PATCH 07/10] tracing: Fix smatch warning for null glob in event_hist_trigger_parse() Steven Rostedt
2022-01-28 16:18 ` [for-linus][PATCH 08/10] tracing: Fix smatch warning for do while check " Steven Rostedt
2022-01-28 16:18 ` [for-linus][PATCH 09/10] tracing: Propagate is_signed to expression Steven Rostedt
2022-01-28 16:18 ` [for-linus][PATCH 10/10] tracing: Dont inc err_log entry count if entry allocation fails Steven Rostedt
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=20220128162343.618746472@goodmis.org \
--to=rostedt@goodmis.org \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=stable@vger.kernel.org \
--cc=xkernel.wang@foxmail.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.