diff options
author | Steven Rostedt (Red Hat) <rostedt@goodmis.org> | 2013-12-22 03:55:17 +0100 |
---|---|---|
committer | Steven Rostedt <rostedt@goodmis.org> | 2014-01-02 22:17:22 +0100 |
commit | d8a30f20347a60a796a5221e07711c0d30d42dc3 (patch) | |
tree | eed4dc37ddf15b981194a573701522605b58e69f /kernel/trace/trace_events_trigger.c | |
parent | tracing: Add generic tracing_lseek() function (diff) | |
download | linux-d8a30f20347a60a796a5221e07711c0d30d42dc3.tar.xz linux-d8a30f20347a60a796a5221e07711c0d30d42dc3.zip |
tracing: Fix rcu handling of event_trigger_data filter field
The filter field of the event_trigger_data structure is protected under
RCU sched locks. It was not annotated as such, and after doing so,
sparse pointed out several locations that required fix ups.
Reported-by: kbuild test robot <fengguang.wu@intel.com>
Tested-by: Tom Zanussi <tom.zanussi@linux.intel.com>
Acked-by: Tom Zanussi <tom.zanussi@linux.intel.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Diffstat (limited to 'kernel/trace/trace_events_trigger.c')
-rw-r--r-- | kernel/trace/trace_events_trigger.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/kernel/trace/trace_events_trigger.c b/kernel/trace/trace_events_trigger.c index 12ac8a5d4d95..f6dd115b958d 100644 --- a/kernel/trace/trace_events_trigger.c +++ b/kernel/trace/trace_events_trigger.c @@ -67,6 +67,7 @@ event_triggers_call(struct ftrace_event_file *file, void *rec) { struct event_trigger_data *data; enum event_trigger_type tt = ETT_NONE; + struct event_filter *filter; if (list_empty(&file->triggers)) return tt; @@ -76,7 +77,8 @@ event_triggers_call(struct ftrace_event_file *file, void *rec) data->ops->func(data); continue; } - if (data->filter && !filter_match_preds(data->filter, rec)) + filter = rcu_dereference(data->filter); + if (filter && !filter_match_preds(filter, rec)) continue; if (data->cmd_ops->post_trigger) { tt |= data->cmd_ops->trigger_type; @@ -703,7 +705,7 @@ static int set_trigger_filter(char *filter_str, if (ret) goto out; assign: - tmp = data->filter; + tmp = rcu_access_pointer(data->filter); rcu_assign_pointer(data->filter, filter); @@ -719,7 +721,7 @@ static int set_trigger_filter(char *filter_str, if (filter_str) { data->filter_str = kstrdup(filter_str, GFP_KERNEL); if (!data->filter_str) { - free_event_filter(data->filter); + free_event_filter(rcu_access_pointer(data->filter)); data->filter = NULL; ret = -ENOMEM; } |