function-graph: Init curr_ret_stack with ret_stack
commit090fe6cbe1fe9f15a219e38c0edea6960dcadb69
authorSteven Rostedt <srostedt@redhat.com>
Sat, 13 Mar 2010 00:41:23 +0000 (12 19:41 -0500)
committerGreg Kroah-Hartman <gregkh@suse.de>
Thu, 1 Apr 2010 22:58:10 +0000 (1 15:58 -0700)
tree346999cc9c79b77f00029bb9a42e951678f047c8
parent9dfa691caee866df28691815e708a914349a6f10
function-graph: Init curr_ret_stack with ret_stack

commit ea14eb714041d40fcc5180b5a586034503650149 upstream.

If the graph tracer is active, and a task is forked but the allocating of
the processes graph stack fails, it can cause crash later on.

This is due to the temporary stack being NULL, but the curr_ret_stack
variable is copied from the parent. If it is not -1, then in
ftrace_graph_probe_sched_switch() the following:

for (index = next->curr_ret_stack; index >= 0; index--)
next->ret_stack[index].calltime += timestamp;

Will cause a kernel OOPS.

Found with Li Zefan's ftrace_stress_test.

Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
kernel/trace/ftrace.c