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
Unified · Split
| @@ -1165,11 +1165,11 @@ static int user_event_parse(char *name, char *args, char *flags, · 1164 unmodified lines | ||
| 1165 | 1165 | #endif |
| 1166 | 1166 | |
| 1167 | 1167 | mutex_lock(&event_mutex); |
| 1168 | + | |
| 1168 | 1169 | ret = user_event_trace_register(user); |
| 1169 | − mutex_unlock(&event_mutex); | |
| 1170 | 1170 | |
| 1171 | 1171 | if (ret) |
| 1172 | − goto put_user; | |
| 1172 | + goto put_user_lock; | |
| 1173 | 1173 | |
| 1174 | 1174 | user->index = index; |
| 1175 | 1175 | |
| @@ -1181,8 +1181,12 @@ static int user_event_parse(char *name, char *args, char *flags, · 5 unmodified lines | ||
| 1181 | 1181 | set_bit(user->index, page_bitmap); |
| 1182 | 1182 | hash_add(register_table, &user->node, key); |
| 1183 | 1183 | |
| 1184 | + mutex_unlock(&event_mutex); | |
| 1185 | + | |
| 1184 | 1186 | *newuser = user; |
| 1185 | 1187 | return 0; |
| 1188 | +put_user_lock: | |
| 1189 | + mutex_unlock(&event_mutex); | |
| 1186 | 1190 | put_user: |
| 1187 | 1191 | user_event_destroy_fields(user); |
| 1188 | 1192 | user_event_destroy_validators(user); |