]> git.karo-electronics.de Git - karo-tx-linux.git/commit
tracing: Fix a race in function profile
authorLi Zefan <lizf@cn.fujitsu.com>
Mon, 23 Aug 2010 08:50:12 +0000 (16:50 +0800)
committerPaul Gortmaker <paul.gortmaker@windriver.com>
Thu, 6 Jan 2011 23:07:45 +0000 (18:07 -0500)
commitc1652827c8578296d0e6560793bbfc213da8e0b6
tree52e42af219e1f999096e94dd366c0ce63ebbe938
parentd7dea4cdd7bf64eb69c4583c9daec870c722bea0
tracing: Fix a race in function profile

commit 3aaba20f26f58843e8f20611e5c0b1c06954310f upstream.

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: Li Zefan <lizf@cn.fujitsu.com>
LKML-Reference: <4C723644.4040708@cn.fujitsu.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
kernel/trace/ftrace.c