ftrace/module: Move ftrace_release_mod() to ddebug_cleanup label

"Linux Kernel Mailing List" <[email protected]>
Newsgroups gmane.linux.kernel.commits.head
Message-ID <[email protected]>
Web:        https://git.kernel.org/torvalds/c/1323eac7fd6560c809aa0ea6081904a5dfa581a9
Commit:     1323eac7fd6560c809aa0ea6081904a5dfa581a9
Parent:     ed875ea1fcc6c34ea232610c3041d0978e327bbe
Refname:    refs/heads/master
Author:     Namit Gupta <[email protected]>
AuthorDate: Mon Jan 8 10:41:21 2018 +0530
Committer:  Jessica Yu <[email protected]>
CommitDate: Mon Jan 15 20:44:21 2018 +0100

    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: Namit Gupta <[email protected]>
    Reviewed-by: Steven Rostedt (VMware) <[email protected]>
    Signed-off-by: Jessica Yu <[email protected]>
---
 kernel/module.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/kernel/module.c b/kernel/module.c
index dea01ac9cb74..10c3c03091d9 100644
--- a/kernel/module.c
+++ b/kernel/module.c
@@ -3789,6 +3789,7 @@ static int load_module(struct load_info *info, const char __user *uargs,
 	module_disable_nx(mod);
 
  ddebug_cleanup:
+	ftrace_release_mod(mod);
 	dynamic_debug_remove(mod, info->debug);
 	synchronize_sched();
 	kfree(mod->args);
@@ -3808,12 +3809,6 @@ static int load_module(struct load_info *info, const char __user *uargs,
 	synchronize_sched();
 	mutex_unlock(&module_mutex);
  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() */
 	lockdep_free_key_range(mod->core_layout.base, mod->core_layout.size);
 
--
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.