Commit ccc6e590 authored by Xiu Jianfeng's avatar Xiu Jianfeng Committed by Steven Rostedt (Google)

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: e5d27181 ("tracing/user_events: Move pages/locks into groups to prepare for namespaces")
Signed-off-by: default avatarXiu Jianfeng <xiujianfeng@huawei.com>
Acked-by: default avatarMasami Hiramatsu (Google) <mhiramat@kernel.org>
Acked-by: default avatarBeau Belgrave <beaub@linux.microsoft.com>
Signed-off-by: default avatarSteven Rostedt (Google) <rostedt@goodmis.org>
parent 0a068f4a
......@@ -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);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment