On Thu, 4 Feb 2016 15:39:35 +0100
Petr Mladek <pmla...@suse.com> 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

Reply via email to