]> 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)
commit9fb24b787665d04d70b839dd694d2a6499ab6bae
tree00dd85ce86d799d9deeb26987c77fb6542f0e38a
parent5080dbbddfc9e1a62c8fd0a54414604a075dcbc0
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