From: Qiu Peiyang <peiyangx....@intel.com> complete_formation might fail. kernel need clean up ftrace records of the module.
The patch fixes it by tuning the operation sequence in complete_formation. After complete_formation checks verify_export_symbols, call ftrace_module_init to init ftrace records. Signed-off-by: Qiu Peiyang <peiyangx....@intel.com> Signed-off-by: Zhang Yanmin <yanmin.zh...@intel.com> --- kernel/module.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/kernel/module.c b/kernel/module.c index 8f051a1..0a67c4e 100644 --- a/kernel/module.c +++ b/kernel/module.c @@ -3373,6 +3373,11 @@ static int complete_formation(struct module *mod, struct load_info *info) /* This relies on module_mutex for list integrity. */ module_bug_finalize(info->hdr, info->sechdrs, mod); + mutex_unlock(&module_mutex); + + /* Ftrace init must be called in the MODULE_STATE_UNFORMED state */ + ftrace_module_init(mod); + /* Set RO and NX regions for core */ set_section_ro_nx(mod->module_core, mod->core_text_size, @@ -3388,7 +3393,6 @@ static int complete_formation(struct module *mod, struct load_info *info) /* Mark state as coming so strong_try_module_get() ignores us, * but kallsyms etc. can see us. */ mod->state = MODULE_STATE_COMING; - mutex_unlock(&module_mutex); blocking_notifier_call_chain(&module_notify_list, MODULE_STATE_COMING, mod); @@ -3505,9 +3509,6 @@ static int load_module(struct load_info *info, const char __user *uargs, dynamic_debug_setup(info->debug, info->num_debug); - /* Ftrace init must be called in the MODULE_STATE_UNFORMED state */ - ftrace_module_init(mod); - /* Finally it's fully formed, ready to start executing. */ err = complete_formation(mod, info); if (err) -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/