function-graph: prevent more than one tracer registering
authorSteven Rostedt <srostedt@redhat.com>
Tue, 24 Mar 2009 04:18:31 +0000 (00:18 -0400)
committerSteven Rostedt <srostedt@redhat.com>
Tue, 24 Mar 2009 13:32:52 +0000 (09:32 -0400)
Impact: prevent crash due to multiple function graph tracers

The function graph tracer can currently only handle a single tracer
being registered. If another tracer registers with the function
graph tracer it can crash the system.

Signed-off-by: Steven Rostedt <srostedt@redhat.com>
kernel/trace/ftrace.c

index 7847806eefef3805cd73ac6562af371e735fb9e6..c81a759fbf76b2eecb767cb35a218c761ed35881 100644 (file)
@@ -2643,6 +2643,12 @@ int register_ftrace_graph(trace_func_graph_ret_t retfunc,
 
        mutex_lock(&ftrace_lock);
 
+       /* we currently allow only one tracer registered at a time */
+       if (atomic_read(&ftrace_graph_active)) {
+               ret = -EBUSY;
+               goto out;
+       }
+
        ftrace_suspend_notifier.notifier_call = ftrace_suspend_notifier_call;
        register_pm_notifier(&ftrace_suspend_notifier);