diff options
Diffstat (limited to 'kernel/trace/ftrace.c')
-rw-r--r-- | kernel/trace/ftrace.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c index c7f4a4be05dc..678e3d6caf85 100644 --- a/kernel/trace/ftrace.c +++ b/kernel/trace/ftrace.c | |||
@@ -928,9 +928,14 @@ void ftrace_release(void *start, unsigned long size) | |||
928 | 928 | ||
929 | mutex_lock(&ftrace_lock); | 929 | mutex_lock(&ftrace_lock); |
930 | do_for_each_ftrace_rec(pg, rec) { | 930 | do_for_each_ftrace_rec(pg, rec) { |
931 | if ((rec->ip >= s) && (rec->ip < e) && | 931 | if ((rec->ip >= s) && (rec->ip < e)) { |
932 | !(rec->flags & FTRACE_FL_FREE)) | 932 | /* |
933 | * rec->ip is changed in ftrace_free_rec() | ||
934 | * It should not between s and e if record was freed. | ||
935 | */ | ||
936 | FTRACE_WARN_ON(rec->flags & FTRACE_FL_FREE); | ||
933 | ftrace_free_rec(rec); | 937 | ftrace_free_rec(rec); |
938 | } | ||
934 | } while_for_each_ftrace_rec(); | 939 | } while_for_each_ftrace_rec(); |
935 | mutex_unlock(&ftrace_lock); | 940 | mutex_unlock(&ftrace_lock); |
936 | } | 941 | } |
@@ -3287,6 +3292,9 @@ void unregister_ftrace_graph(void) | |||
3287 | { | 3292 | { |
3288 | mutex_lock(&ftrace_lock); | 3293 | mutex_lock(&ftrace_lock); |
3289 | 3294 | ||
3295 | if (!unlikely(atomic_read(&ftrace_graph_active))) | ||
3296 | goto out; | ||
3297 | |||
3290 | atomic_dec(&ftrace_graph_active); | 3298 | atomic_dec(&ftrace_graph_active); |
3291 | unregister_trace_sched_switch(ftrace_graph_probe_sched_switch); | 3299 | unregister_trace_sched_switch(ftrace_graph_probe_sched_switch); |
3292 | ftrace_graph_return = (trace_func_graph_ret_t)ftrace_stub; | 3300 | ftrace_graph_return = (trace_func_graph_ret_t)ftrace_stub; |
@@ -3294,6 +3302,7 @@ void unregister_ftrace_graph(void) | |||
3294 | ftrace_shutdown(FTRACE_STOP_FUNC_RET); | 3302 | ftrace_shutdown(FTRACE_STOP_FUNC_RET); |
3295 | unregister_pm_notifier(&ftrace_suspend_notifier); | 3303 | unregister_pm_notifier(&ftrace_suspend_notifier); |
3296 | 3304 | ||
3305 | out: | ||
3297 | mutex_unlock(&ftrace_lock); | 3306 | mutex_unlock(&ftrace_lock); |
3298 | } | 3307 | } |
3299 | 3308 | ||