Skip to content

Commit efe34e9

Browse files
beaubelgraverostedt
authored andcommitted
tracing/user_events: Hold event_mutex during dyn_event_add
Make sure the event_mutex is properly held during dyn_event_add call. This is required when adding dynamic events. Link: https://lkml.kernel.org/r/20220328223225.1992-1-beaub@linux.microsoft.com Reported-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com> Signed-off-by: Beau Belgrave <beaub@linux.microsoft.com> Acked-by: Masami Hiramatsu <mhiramat@kernel.org> Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
1 parent bed5b60 commit efe34e9

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

kernel/trace/trace_events_user.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1165,11 +1165,11 @@ static int user_event_parse(char *name, char *args, char *flags,
11651165
#endif
11661166

11671167
mutex_lock(&event_mutex);
1168+
11681169
ret = user_event_trace_register(user);
1169-
mutex_unlock(&event_mutex);
11701170

11711171
if (ret)
1172-
goto put_user;
1172+
goto put_user_lock;
11731173

11741174
user->index = index;
11751175

@@ -1181,8 +1181,12 @@ static int user_event_parse(char *name, char *args, char *flags,
11811181
set_bit(user->index, page_bitmap);
11821182
hash_add(register_table, &user->node, key);
11831183

1184+
mutex_unlock(&event_mutex);
1185+
11841186
*newuser = user;
11851187
return 0;
1188+
put_user_lock:
1189+
mutex_unlock(&event_mutex);
11861190
put_user:
11871191
user_event_destroy_fields(user);
11881192
user_event_destroy_validators(user);

0 commit comments

Comments
 (0)