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>
This commit is contained in:
parent
bed5b60bf6
commit
efe34e99fc
|
@ -1165,11 +1165,11 @@ static int user_event_parse(char *name, char *args, char *flags,
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
mutex_lock(&event_mutex);
|
mutex_lock(&event_mutex);
|
||||||
|
|
||||||
ret = user_event_trace_register(user);
|
ret = user_event_trace_register(user);
|
||||||
mutex_unlock(&event_mutex);
|
|
||||||
|
|
||||||
if (ret)
|
if (ret)
|
||||||
goto put_user;
|
goto put_user_lock;
|
||||||
|
|
||||||
user->index = index;
|
user->index = index;
|
||||||
|
|
||||||
|
@ -1181,8 +1181,12 @@ static int user_event_parse(char *name, char *args, char *flags,
|
||||||
set_bit(user->index, page_bitmap);
|
set_bit(user->index, page_bitmap);
|
||||||
hash_add(register_table, &user->node, key);
|
hash_add(register_table, &user->node, key);
|
||||||
|
|
||||||
|
mutex_unlock(&event_mutex);
|
||||||
|
|
||||||
*newuser = user;
|
*newuser = user;
|
||||||
return 0;
|
return 0;
|
||||||
|
put_user_lock:
|
||||||
|
mutex_unlock(&event_mutex);
|
||||||
put_user:
|
put_user:
|
||||||
user_event_destroy_fields(user);
|
user_event_destroy_fields(user);
|
||||||
user_event_destroy_validators(user);
|
user_event_destroy_validators(user);
|
||||||
|
|
Loading…
Reference in New Issue