Skip to content

Commit 42fab4b

Browse files
Li ZefanIngo Molnar
authored andcommitted
tracing/ftrace: add missing unlock in register_stat_tracer()
We should unlock all_stat_sessions_mutex before returning failure. Signed-off-by: Li Zefan <lizf@cn.fujitsu.com> Signed-off-by: Steven Rostedt <srostedt@redhat.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
1 parent 4a2b8dd commit 42fab4b

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

kernel/trace/trace_stat.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,10 @@ int register_stat_tracer(struct tracer_stat *trace)
7373
/* Already registered? */
7474
mutex_lock(&all_stat_sessions_mutex);
7575
list_for_each_entry_safe(node, tmp, &all_stat_sessions, session_list) {
76-
if (node->ts == trace)
76+
if (node->ts == trace) {
77+
mutex_unlock(&all_stat_sessions_mutex);
7778
return -EINVAL;
79+
}
7880
}
7981
mutex_unlock(&all_stat_sessions_mutex);
8082

0 commit comments

Comments
 (0)