Skip to content

Commit 406acdd

Browse files
committed
ftrace: Add another check for match in register_ftrace_direct()
As an instruction pointer passed into register_ftrace_direct() may just exist on the ftrace call site, but may not be the start of the call site itself, register_ftrace_direct() still needs to update test if a direct call exists on the normalized site, as only one direct call is allowed at any one time. Fixes: 763e34e ("ftrace: Add register_ftrace_direct()") Signed-off-by: Steven Rostedt (VMware) <[email protected]>
1 parent 1c7f9b6 commit 406acdd

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

kernel/trace/ftrace.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5030,7 +5030,12 @@ int register_ftrace_direct(unsigned long ip, unsigned long addr)
50305030
goto out_unlock;
50315031

50325032
/* Make sure the ip points to the exact record */
5033-
ip = rec->ip;
5033+
if (ip != rec->ip) {
5034+
ip = rec->ip;
5035+
/* Need to check this ip for a direct. */
5036+
if (find_rec_direct(ip))
5037+
goto out_unlock;
5038+
}
50345039

50355040
ret = -ENOMEM;
50365041
if (ftrace_hash_empty(direct_functions) ||

0 commit comments

Comments
 (0)