Skip to content

Commit 7d5b7ca

Browse files
Jiri Olsarostedt
authored andcommitted
ftrace: Use direct_ops hash in unregister_ftrace_direct
Now when we have *direct_multi interface the direct_functions hash is no longer owned just by direct_ops. It's also used by any other ftrace_ops passed to *direct_multi interface. Thus to find out that we are unregistering the last function from direct_ops, we need to check directly direct_ops's hash. Link: https://lkml.kernel.org/r/20211206182032.87248-2-jolsa@kernel.org Cc: Ingo Molnar <mingo@redhat.com> Cc: Heiko Carstens <hca@linux.ibm.com> Fixes: f64dd46 ("ftrace: Add multi direct register/unregister interface") Signed-off-by: Jiri Olsa <jolsa@kernel.org> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
1 parent 48b27b6 commit 7d5b7ca

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

kernel/trace/ftrace.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5217,6 +5217,7 @@ int unregister_ftrace_direct(unsigned long ip, unsigned long addr)
52175217
{
52185218
struct ftrace_direct_func *direct;
52195219
struct ftrace_func_entry *entry;
5220+
struct ftrace_hash *hash;
52205221
int ret = -ENODEV;
52215222

52225223
mutex_lock(&direct_mutex);
@@ -5225,7 +5226,8 @@ int unregister_ftrace_direct(unsigned long ip, unsigned long addr)
52255226
if (!entry)
52265227
goto out_unlock;
52275228

5228-
if (direct_functions->count == 1)
5229+
hash = direct_ops.func_hash->filter_hash;
5230+
if (hash->count == 1)
52295231
unregister_ftrace_function(&direct_ops);
52305232

52315233
ret = ftrace_set_filter_ip(&direct_ops, ip, 1, 0);

0 commit comments

Comments
 (0)