]> git.baikalelectronics.ru Git - kernel.git/commit
ftrace: Do not hold references of ftrace_graph_{notrace_}hash out of graph_lock
authorSteven Rostedt (VMware) <rostedt@goodmis.org>
Fri, 3 Feb 2017 01:16:29 +0000 (20:16 -0500)
committerSteven Rostedt (VMware) <rostedt@goodmis.org>
Fri, 3 Feb 2017 15:59:42 +0000 (10:59 -0500)
commitf1d8b66d568072ca387aafd92e994d8bda40024e
tree00dd85ce86d799d9deeb26987c77fb6542f0e38a
parentf2cd9eb41547aef05f36107f08cb2a9e63640012
ftrace: Do not hold references of ftrace_graph_{notrace_}hash out of graph_lock

The hashs ftrace_graph_hash and ftrace_graph_notrace_hash are modified
within the graph_lock being held. Holding a pointer to them and passing them
along can lead to a use of a stale pointer (fgd->hash). Move assigning the
pointer and its use to within the holding of the lock. Note, it's an
rcu_sched protected data, and other instances of referencing them are done
with preemption disabled. But the file manipuation code must be protected by
the lock.

The fgd->hash pointer is set to NULL when the lock is being released.

Acked-by: Namhyung Kim <namhyung@kernel.org>
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
kernel/trace/ftrace.c