• S
    tracing: Use same local variable when resetting the ring buffer · 283740c6
    Steven Rostedt 提交于
    In the ftrace code that resets the ring buffer it references the
    buffer with a local variable, but then uses the tr->buffer as the
    parameter to reset. If the wakeup tracer is running, which can
    switch the tr->buffer with the max saved buffer, this can break
    the requirement of disabling the buffer before the reset.
    
       buffer = tr->buffer;
       ring_buffer_record_disable(buffer);
       synchronize_sched();
       __tracing_reset(tr->buffer, cpu);
    
    If the tr->buffer is swapped, then the reset is not happening to the
    buffer that was disabled. This will cause the ring buffer to fail.
    
    Found with Li Zefan's ftrace_stress_test.
    
    Cc: stable@kernel.org
    Reported-by: NLai Jiangshan <laijs@cn.fujitsu.com>
    Signed-off-by: NSteven Rostedt <rostedt@goodmis.org>
    283740c6
trace.c 101.3 KB