Skip to content
  • Li Zefan's avatar
    tracing: Fix a race in function profile · 3aaba20f
    Li Zefan authored
    
    
    While we are reading trace_stat/functionX and someone just
    disabled function_profile at that time, we can trigger this:
    
    	divide error: 0000 [#1] PREEMPT SMP
    	...
    	EIP is at function_stat_show+0x90/0x230
    	...
    
    This fix just takes the ftrace_profile_lock and checks if
    rec->counter is 0. If it's 0, we know the profile buffer
    has been reset.
    
    Signed-off-by: default avatarLi Zefan <lizf@cn.fujitsu.com>
    Cc: stable@kernel.org
    LKML-Reference: <4C723644.4040708@cn.fujitsu.com>
    Signed-off-by: default avatarSteven Rostedt <rostedt@goodmis.org>
    3aaba20f