提交 b2ad368b 编写于 作者: A Anton Vorontsov 提交者: Greg Kroah-Hartman

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: NAnton Vorontsov <anton.vorontsov@linaro.org>
Acked-by: NSteven Rostedt <rostedt@goodmis.org>
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
上级 c1743cbc
......@@ -3172,10 +3172,10 @@ static int tracing_set_tracer(const char *buf)
}
destroy_trace_option_files(topts);
current_trace = t;
current_trace = &nop_trace;
topts = create_trace_option_files(current_trace);
if (current_trace->use_max_tr) {
topts = create_trace_option_files(t);
if (t->use_max_tr) {
int cpu;
/* we need to make per cpu buffer sizes equivalent */
for_each_tracing_cpu(cpu) {
......@@ -3195,6 +3195,7 @@ static int tracing_set_tracer(const char *buf)
goto out;
}
current_trace = t;
trace_branch_enable(tr);
out:
mutex_unlock(&trace_types_lock);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册