History

ftrace: Protect direct_functions in ftrace_find_rec_direct

Fix accessing the __rcu pointer direct_functions with RCU protection.

Leon Hwang committed 3 months ago

Commit 63444b71 parent f0ece161 file · +2 −1Browse files

Unified · Split

kernel/trace/ftrace.c+2−1
@@ -2645,7 +2645,8 @@ unsigned long ftrace_find_rec_direct(unsigned long ip) · 2644 unmodified lines
2645{2645{
2646 struct ftrace_func_entry *entry;2646 struct ftrace_func_entry *entry;
2647 2647
2648 entry = __ftrace_lookup_ip(direct_functions, ip);2648 guard(preempt_notrace)();
2649 entry = __ftrace_lookup_ip(rcu_dereference_sched(direct_functions), ip);
2649 if (!entry)2650 if (!entry)
2650 return 0;2651 return 0;
2651 2652