Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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>

authored by

Xiu Jianfeng and committed by
Steven Rostedt (Google)
ccc6e590 0a068f4a

+3 -1
+3 -1
kernel/trace/trace_events_user.c
··· 1100 1100 1101 1101 group = current_user_event_group(); 1102 1102 1103 - if (!group) 1103 + if (!group) { 1104 + kfree(name); 1104 1105 return -ENOENT; 1106 + } 1105 1107 1106 1108 mutex_lock(&group->reg_mutex); 1107 1109