aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/trace
diff options
context:
space:
mode:
authorAnton Vorontsov <anton.vorontsov@linaro.org>2012-07-09 20:10:39 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2012-07-17 12:50:53 -0400
commitb2ad368bebc0f772613668e893fa176396e9094c (patch)
treef2c14b8eea287afdab9eb5eba59792e1048b212a /kernel/trace
parentc1743cbc8d20d208bb1d2b10598204f2d89b144c (diff)
tracing: Fix initialization failure path in tracing_set_tracer()
If tracer->init() fails, current code will leave current_tracer pointing to an unusable tracer, which at best makes 'current_tracer' report inaccurate value. Fix the issue by pointing current_tracer to nop tracer, and only update current_tracer with the new one after all the initialization succeeds. Signed-off-by: Anton Vorontsov <anton.vorontsov@linaro.org> Acked-by: Steven Rostedt <rostedt@goodmis.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'kernel/trace')
-rw-r--r--kernel/trace/trace.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
index 49249c28690d..44ee11e31b82 100644
--- a/kernel/trace/trace.c
+++ b/kernel/trace/trace.c
@@ -3172,10 +3172,10 @@ static int tracing_set_tracer(const char *buf)
3172 } 3172 }
3173 destroy_trace_option_files(topts); 3173 destroy_trace_option_files(topts);
3174 3174
3175 current_trace = t; 3175 current_trace = &nop_trace;
3176 3176
3177 topts = create_trace_option_files(current_trace); 3177 topts = create_trace_option_files(t);
3178 if (current_trace->use_max_tr) { 3178 if (t->use_max_tr) {
3179 int cpu; 3179 int cpu;
3180 /* we need to make per cpu buffer sizes equivalent */ 3180 /* we need to make per cpu buffer sizes equivalent */
3181 for_each_tracing_cpu(cpu) { 3181 for_each_tracing_cpu(cpu) {
@@ -3195,6 +3195,7 @@ static int tracing_set_tracer(const char *buf)
3195 goto out; 3195 goto out;
3196 } 3196 }
3197 3197
3198 current_trace = t;
3198 trace_branch_enable(tr); 3199 trace_branch_enable(tr);
3199 out: 3200 out:
3200 mutex_unlock(&trace_types_lock); 3201 mutex_unlock(&trace_types_lock);