diff options
Diffstat (limited to 'kernel/trace/ftrace.c')
-rw-r--r-- | kernel/trace/ftrace.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c index eca34503f178..f9821a3374e9 100644 --- a/kernel/trace/ftrace.c +++ b/kernel/trace/ftrace.c | |||
@@ -3095,6 +3095,14 @@ t_probe_next(struct seq_file *m, loff_t *pos) | |||
3095 | hnd = &iter->probe_entry->hlist; | 3095 | hnd = &iter->probe_entry->hlist; |
3096 | 3096 | ||
3097 | hash = iter->probe->ops.func_hash->filter_hash; | 3097 | hash = iter->probe->ops.func_hash->filter_hash; |
3098 | |||
3099 | /* | ||
3100 | * A probe being registered may temporarily have an empty hash | ||
3101 | * and it's at the end of the func_probes list. | ||
3102 | */ | ||
3103 | if (!hash || hash == EMPTY_HASH) | ||
3104 | return NULL; | ||
3105 | |||
3098 | size = 1 << hash->size_bits; | 3106 | size = 1 << hash->size_bits; |
3099 | 3107 | ||
3100 | retry: | 3108 | retry: |
@@ -4320,12 +4328,21 @@ register_ftrace_function_probe(char *glob, struct trace_array *tr, | |||
4320 | 4328 | ||
4321 | mutex_unlock(&ftrace_lock); | 4329 | mutex_unlock(&ftrace_lock); |
4322 | 4330 | ||
4331 | /* | ||
4332 | * Note, there's a small window here that the func_hash->filter_hash | ||
4333 | * may be NULL or empty. Need to be carefule when reading the loop. | ||
4334 | */ | ||
4323 | mutex_lock(&probe->ops.func_hash->regex_lock); | 4335 | mutex_lock(&probe->ops.func_hash->regex_lock); |
4324 | 4336 | ||
4325 | orig_hash = &probe->ops.func_hash->filter_hash; | 4337 | orig_hash = &probe->ops.func_hash->filter_hash; |
4326 | old_hash = *orig_hash; | 4338 | old_hash = *orig_hash; |
4327 | hash = alloc_and_copy_ftrace_hash(FTRACE_HASH_DEFAULT_BITS, old_hash); | 4339 | hash = alloc_and_copy_ftrace_hash(FTRACE_HASH_DEFAULT_BITS, old_hash); |
4328 | 4340 | ||
4341 | if (!hash) { | ||
4342 | ret = -ENOMEM; | ||
4343 | goto out; | ||
4344 | } | ||
4345 | |||
4329 | ret = ftrace_match_records(hash, glob, strlen(glob)); | 4346 | ret = ftrace_match_records(hash, glob, strlen(glob)); |
4330 | 4347 | ||
4331 | /* Nothing found? */ | 4348 | /* Nothing found? */ |