ftrace: Fix synchronization location disabling and freeing ftrace_ops
authorSteven Rostedt (Red Hat) <rostedt@goodmis.org>
Mon, 13 Jan 2014 17:56:21 +0000 (12:56 -0500)
committerBen Hutchings <ben@decadent.org.uk>
Tue, 1 Apr 2014 23:58:42 +0000 (00:58 +0100)
commit82d12fc84435b9c815357e306dfd844f54a62714
treed3d3708e7d4364e471df584b2b3bc8bf1852112e
parent9f9b9ac2ccbd28e2a07a40abdfc3b598f107933a
ftrace: Fix synchronization location disabling and freeing ftrace_ops

commit a4c35ed241129dd142be4cadb1e5a474a56d5464 upstream.

The synchronization needed after ftrace_ops are unregistered must happen
after the callback is disabled from becing called by functions.

The current location happens after the function is being removed from the
internal lists, but not after the function callbacks were disabled, leaving
the functions susceptible of being called after their callbacks are freed.

This affects perf and any externel users of function tracing (LTTng and
SystemTap).

Fixes: cdbe61bfe704 "ftrace: Allow dynamically allocated function tracers"
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
[bwh: Backported to 3.2: drop change for control ops]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Acked-by: Steven Rostedt <rostedt@goodmis.org>
kernel/trace/ftrace.c