Skip to content

Commit

Permalink
tracing/user_events: Hold event_mutex during dyn_event_add
Browse files Browse the repository at this point in the history
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/[email protected]

Reported-by: Mathieu Desnoyers <[email protected]>
Signed-off-by: Beau Belgrave <[email protected]>
Acked-by: Masami Hiramatsu <[email protected]>
Signed-off-by: Steven Rostedt (Google) <[email protected]>
  • Loading branch information
beaubelgrave authored and rostedt committed Apr 2, 2022
1 parent bed5b60 commit efe34e9
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions kernel/trace/trace_events_user.c
Original file line number Diff line number Diff line change
Expand Up @@ -1165,11 +1165,11 @@ static int user_event_parse(char *name, char *args, char *flags,
#endif

mutex_lock(&event_mutex);

ret = user_event_trace_register(user);
mutex_unlock(&event_mutex);

if (ret)
goto put_user;
goto put_user_lock;

user->index = index;

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

mutex_unlock(&event_mutex);

*newuser = user;
return 0;
put_user_lock:
mutex_unlock(&event_mutex);
put_user:
user_event_destroy_fields(user);
user_event_destroy_validators(user);
Expand Down

0 comments on commit efe34e9

Please sign in to comment.