Commit 1323eac7 authored by Namit Gupta's avatar Namit Gupta Committed by Jessica Yu

ftrace/module: Move ftrace_release_mod() to ddebug_cleanup label

ftrace_module_init happen after dynamic_debug_setup, it is desired that
cleanup should be called after this label however in current implementation
it is called in free module label,ie:even though ftrace in not initialized,
from so many fail case ftrace_release_mod() will be called and unnecessary
traverse the whole list.
In below patch we moved ftrace_release_mod() from free_module label to
ddebug_cleanup label. that is the best possible location, other solution
is to make new label to ftrace_release_mod() but since ftrace_module_init()
is not return with minimum changes it should be in ddebug_cleanup label.
Signed-off-by: default avatarNamit Gupta <gupta.namit@samsung.com>
Reviewed-by: default avatarSteven Rostedt (VMware) <rostedt@goodmis.org>
Signed-off-by: default avatarJessica Yu <jeyu@kernel.org>
parent ed875ea1
...@@ -3789,6 +3789,7 @@ static int load_module(struct load_info *info, const char __user *uargs, ...@@ -3789,6 +3789,7 @@ static int load_module(struct load_info *info, const char __user *uargs,
module_disable_nx(mod); module_disable_nx(mod);
ddebug_cleanup: ddebug_cleanup:
ftrace_release_mod(mod);
dynamic_debug_remove(mod, info->debug); dynamic_debug_remove(mod, info->debug);
synchronize_sched(); synchronize_sched();
kfree(mod->args); kfree(mod->args);
...@@ -3808,12 +3809,6 @@ static int load_module(struct load_info *info, const char __user *uargs, ...@@ -3808,12 +3809,6 @@ static int load_module(struct load_info *info, const char __user *uargs,
synchronize_sched(); synchronize_sched();
mutex_unlock(&module_mutex); mutex_unlock(&module_mutex);
free_module: free_module:
/*
* Ftrace needs to clean up what it initialized.
* This does nothing if ftrace_module_init() wasn't called,
* but it must be called outside of module_mutex.
*/
ftrace_release_mod(mod);
/* Free lock-classes; relies on the preceding sync_rcu() */ /* Free lock-classes; relies on the preceding sync_rcu() */
lockdep_free_key_range(mod->core_layout.base, mod->core_layout.size); lockdep_free_key_range(mod->core_layout.base, mod->core_layout.size);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment