From: Steven Rostedt <rostedt@goodmis.org>
To: linux-kernel@vger.kernel.org
Cc: Masami Hiramatsu <mhiramat@kernel.org>,
Andrew Morton <akpm@linux-foundation.org>,
Xiu Jianfeng <xiujianfeng@huawei.com>,
Beau Belgrave <beaub@linux.microsoft.com>
Subject: [for-linus][PATCH 2/6] tracing/user_events: Fix memory leak in user_event_create()
Date: Thu, 24 Nov 2022 09:47:54 -0500 [thread overview]
Message-ID: <20221124144823.750570677@goodmis.org> (raw)
In-Reply-To: 20221124144752.427194398@goodmis.org
From: Xiu Jianfeng <xiujianfeng@huawei.com>
Before current_user_event_group(), it has allocated memory and save it
in @name, this should freed before return error.
Link: https://lkml.kernel.org/r/20221115014445.158419-1-xiujianfeng@huawei.com
Fixes: e5d271812e7a ("tracing/user_events: Move pages/locks into groups to prepare for namespaces")
Signed-off-by: Xiu Jianfeng <xiujianfeng@huawei.com>
Acked-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
Acked-by: Beau Belgrave <beaub@linux.microsoft.com>
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
---
kernel/trace/trace_events_user.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/kernel/trace/trace_events_user.c b/kernel/trace/trace_events_user.c
index ae78c2d53c8a..539b08ae7020 100644
--- a/kernel/trace/trace_events_user.c
+++ b/kernel/trace/trace_events_user.c
@@ -1100,8 +1100,10 @@ static int user_event_create(const char *raw_command)
group = current_user_event_group();
- if (!group)
+ if (!group) {
+ kfree(name);
return -ENOENT;
+ }
mutex_lock(&group->reg_mutex);
--
2.35.1
next prev parent reply other threads:[~2022-11-24 14:48 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-24 14:47 [for-linus][PATCH 0/6] tracing: Fixes for 6.1 Steven Rostedt
2022-11-24 14:47 ` [for-linus][PATCH 1/6] tracing/hist: add in missing * in comment blocks Steven Rostedt
2022-11-24 14:47 ` Steven Rostedt [this message]
2022-11-24 14:47 ` [for-linus][PATCH 3/6] tracing/osnoise: Fix duration type Steven Rostedt
2022-11-24 14:47 ` [for-linus][PATCH 4/6] tracing: Fix race where histograms can be called before the event Steven Rostedt
2022-11-24 14:47 ` [for-linus][PATCH 5/6] tracing: Add tracing_reset_all_online_cpus_unlocked() function 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=20221124144823.750570677@goodmis.org \
--to=rostedt@goodmis.org \
--cc=akpm@linux-foundation.org \
--cc=beaub@linux.microsoft.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mhiramat@kernel.org \
--cc=xiujianfeng@huawei.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox