tracing: Add rcu dereference annotation for filter->prog
authorSteven Rostedt (VMware) <rostedt@goodmis.org>
Thu, 5 Apr 2018 17:39:36 +0000 (13:39 -0400)
committerSteven Rostedt (VMware) <rostedt@goodmis.org>
Fri, 6 Apr 2018 12:56:53 +0000 (08:56 -0400)
ftrace_function_set_filter() referenences filter->prog without annotation
and sparse complains about it. It needs a rcu_dereference_protected()
wrapper.

Reported-by: kbuild test robot <fengguang.wu@intel.com>
Fixes: 80765597bc587 ("tracing: Rewrite filter logic to be simpler and faster")
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
kernel/trace/trace_events_filter.c

index 703a416aa5c20b881e1e7ef6d3d002a5323fef61..cf8460caa95cbe95f21d96aaf579da1bd424b02b 100644 (file)
@@ -1992,7 +1992,8 @@ static bool is_or(struct prog_entry *prog, int i)
 static int ftrace_function_set_filter(struct perf_event *event,
                                      struct event_filter *filter)
 {
-       struct prog_entry *prog = filter->prog;
+       struct prog_entry *prog = rcu_dereference_protected(filter->prog,
+                                               lockdep_is_held(&event_mutex));
        struct function_filter_data data = {
                .first_filter  = 1,
                .first_notrace = 1,