提交 d3d9acf6 编写于 作者: T Tejun Heo 提交者: Steven Rostedt

trace_events_filter: Use rcu_assign_pointer() when setting ftrace_event_call->filter

ftrace_event_call->filter is sched RCU protected but didn't use
rcu_assign_pointer().  Use it.

TODO: Add proper __rcu annotation to call->filter and all its users.

-v2: Use RCU_INIT_POINTER() for %NULL clearing as suggested by Eric.

Link: http://lkml.kernel.org/r/20111123164949.GA29639@google.com

Cc: Eric Dumazet <eric.dumazet@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: stable@kernel.org # (2.6.39+)
Signed-off-by: NTejun Heo <tj@kernel.org>
Signed-off-by: NSteven Rostedt <rostedt@goodmis.org>
上级 4a1dba72
...@@ -1686,7 +1686,7 @@ static int replace_system_preds(struct event_subsystem *system, ...@@ -1686,7 +1686,7 @@ static int replace_system_preds(struct event_subsystem *system,
* replace the filter for the call. * replace the filter for the call.
*/ */
filter = call->filter; filter = call->filter;
call->filter = filter_item->filter; rcu_assign_pointer(call->filter, filter_item->filter);
filter_item->filter = filter; filter_item->filter = filter;
fail = false; fail = false;
...@@ -1741,7 +1741,7 @@ int apply_event_filter(struct ftrace_event_call *call, char *filter_string) ...@@ -1741,7 +1741,7 @@ int apply_event_filter(struct ftrace_event_call *call, char *filter_string)
filter = call->filter; filter = call->filter;
if (!filter) if (!filter)
goto out_unlock; goto out_unlock;
call->filter = NULL; RCU_INIT_POINTER(call->filter, NULL);
/* Make sure the filter is not being used */ /* Make sure the filter is not being used */
synchronize_sched(); synchronize_sched();
__free_filter(filter); __free_filter(filter);
...@@ -1782,7 +1782,7 @@ int apply_event_filter(struct ftrace_event_call *call, char *filter_string) ...@@ -1782,7 +1782,7 @@ int apply_event_filter(struct ftrace_event_call *call, char *filter_string)
* string * string
*/ */
tmp = call->filter; tmp = call->filter;
call->filter = filter; rcu_assign_pointer(call->filter, filter);
if (tmp) { if (tmp) {
/* Make sure the call is done with the filter */ /* Make sure the call is done with the filter */
synchronize_sched(); synchronize_sched();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册