summaryrefslogtreecommitdiff
path: root/kernel
diff options
context:
space:
mode:
authorXiu Jianfeng <xiujianfeng@huawei.com>2022-11-15 04:44:45 +0300
committerSteven Rostedt (Google) <rostedt@goodmis.org>2022-11-23 02:09:50 +0300
commitccc6e5900745a60073e4967f04b618cdd92b63d6 (patch)
tree3e48612d0fef0ff4bb8bb712f5a4dc188c4b437c /kernel
parent0a068f4a717f2a68b34452de682accbb1a40bed0 (diff)
downloadlinux-ccc6e5900745a60073e4967f04b618cdd92b63d6.tar.xz
tracing/user_events: Fix memory leak in user_event_create()
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>
Diffstat (limited to 'kernel')
-rw-r--r--kernel/trace/trace_events_user.c4
1 files changed, 3 insertions, 1 deletions
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);