function-graph: only allocate init tasks if it was not already done
authorSteven Rostedt <srostedt@redhat.com>
Tue, 2 Jun 2009 16:03:19 +0000 (12:03 -0400)
committerSteven Rostedt <rostedt@goodmis.org>
Tue, 2 Jun 2009 16:03:19 +0000 (12:03 -0400)
commit179c498ae2998461fe436437a74dc29036fc7dcc
tree7794227a9cc45c2ec22d3e3b3062a96d34e8b0b9
parent88fc86c283d9c3854e67e4155808027bc2519eb6
function-graph: only allocate init tasks if it was not already done

When the function graph tracer is enabled, it calls the initialization
needed for the init tasks that would be called on all created tasks.

The problem is that this is called every time the function graph tracer
is enabled, and the ret_stack is allocated for the idle tasks each time.
Thus, the old ret_stack is lost and a memory leak is created.

This is also dangerous because if an interrupt happened on another CPU
with the init task and the ret_stack is replaced, we then lose all the
return pointers for the interrupt, and a crash would take place.

[ Impact: fix memory leak and possible crash due to race ]

Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
kernel/trace/ftrace.c