]> git.ipfire.org Git - people/ms/linux.git/commitdiff
ftrace/direct: Fix lockup in modify_ftrace_direct_multi
authorJiri Olsa <jolsa@redhat.com>
Tue, 9 Nov 2021 11:42:17 +0000 (12:42 +0100)
committerSteven Rostedt (VMware) <rostedt@goodmis.org>
Wed, 10 Nov 2021 16:56:43 +0000 (11:56 -0500)
We can't call unregister_ftrace_function under ftrace_lock.

Link: https://lkml.kernel.org/r/20211109114217.1645296-1-jolsa@kernel.org
Fixes: ed29271894aa ("ftrace/direct: Do not disable when switching direct callers")
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
kernel/trace/ftrace.c

index b4ed1a301232aaa8b8307b8b763d310b819470c9..fc49e8809a5666872de0f947b676b196a459d255 100644 (file)
@@ -5602,10 +5602,11 @@ int modify_ftrace_direct_multi(struct ftrace_ops *ops, unsigned long addr)
                }
        }
 
+       mutex_unlock(&ftrace_lock);
+
        /* Removing the tmp_ops will add the updated direct callers to the functions */
        unregister_ftrace_function(&tmp_ops);
 
-       mutex_unlock(&ftrace_lock);
  out_direct:
        mutex_unlock(&direct_mutex);
        return err;