lkml.org 
[lkml]   [2016]   [Feb]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [PATCH v2 2/2] livepatch/module: remove livepatch module notifier
    On Thu, 4 Feb 2016 15:39:35 +0100
    Petr Mladek <pmladek@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

    \
     
     \ /
      Last update: 2016-02-04 16:21    [W:4.150 / U:0.032 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site