lkml.org 
[lkml]   [2012]   [Jul]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH 1/8] tracing: Fix initialization failure path in tracing_set_tracer()
    Date
    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>
    ---
    kernel/trace/trace.c | 7 ++++---
    1 file changed, 4 insertions(+), 3 deletions(-)

    diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
    index 814ff30..954f7d7 100644
    --- a/kernel/trace/trace.c
    +++ b/kernel/trace/trace.c
    @@ -3183,10 +3183,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) {
    @@ -3206,6 +3206,7 @@ static int tracing_set_tracer(const char *buf)
    goto out;
    }

    + current_trace = t;
    trace_branch_enable(tr);
    out:
    mutex_unlock(&trace_types_lock);
    --
    1.7.10.4


    \
     
     \ /
      Last update: 2012-07-10 03:01    [W:0.024 / U:30.048 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site