On Thu, 4 Feb 2016 15:39:35 +0100 Petr Mladek <pmladek@xxxxxxxx> wrote: > > @@ -3375,6 +3378,10 @@ static int complete_formation(struct module *mod, struct load_info *info) > > mutex_unlock(&module_mutex); > > > > ftrace_module_enable(mod); > > + err = klp_module_enable(mod); > > + if (err) > > + goto out; > > If you go out here, you need to revert some some operations > that are normally done in the bug_cleanup: goto target > in load_module(). In particular, you need to do: > > /* module_bug_cleanup needs module_mutex protection */ > mutex_lock(&module_mutex); > module_bug_cleanup(mod); > mutex_unlock(&module_mutex); > > ftrace_release_mod(mod); > > /* we can't deallocate the module until we clear memory protection */ > module_disable_ro(mod); > module_disable_nx(mod); > > > IMHO, it would make sense to somehow split the complete_formation() function > and avoid a code duplication in the error paths. If complete_formation() fails, load_module will do a goto ddebug_cleanup, which will eventually call ftrace_release_mod(). No need to do it here. -- Steve -- To unsubscribe from this list: send the line "unsubscribe live-patching" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html