From: Ye Bin <yebi...@huawei.com> If the ftrace is disabled, it is meaningless to allocate module map. So add check in ftrace_free_mem().
Signed-off-by: Ye Bin <yebi...@huawei.com> --- kernel/trace/ftrace.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c index ff5d9d73a4a7..56adf45de92e 100644 --- a/kernel/trace/ftrace.c +++ b/kernel/trace/ftrace.c @@ -7824,6 +7824,11 @@ void ftrace_free_mem(struct module *mod, void *start_ptr, void *end_ptr) mutex_lock(&ftrace_lock); + if (ftrace_disabled || (mod && !mod->num_ftrace_callsites)) { + mutex_unlock(&ftrace_lock); + return; + } + /* * If we are freeing module init memory, then check if * any tracer is active. If so, we need to save a mapping of -- 2.34.1