ftrace/direct: Fix lockup in modify_ftrace_direct_multi

Bugzilla: https://bugzilla.redhat.com/2137876

Upstream Status: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git

commit 2e6e9058d13a22a6fdd36a8c444ac71d9656003a
Author: Jiri Olsa <jolsa@redhat.com>
Date:   Tue Nov 9 12:42:17 2021 +0100

    ftrace/direct: Fix lockup in modify_ftrace_direct_multi

    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>

Signed-off-by: Artem Savkov <asavkov@redhat.com>
This commit is contained in:
Artem Savkov 2022-10-31 15:39:40 +01:00
parent 119b491f4f
commit 45f7db07df
1 changed files with 2 additions and 1 deletions

View File

@ -5802,10 +5802,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;