Skip to content

Commit

Permalink
kernel/module.c: Free lock-classes if parse_args failed
Browse files Browse the repository at this point in the history
parse_args call module parameters' .set handlers, which may use locks defined in the module.
So, these classes should be freed in case parse_args returns error(e.g. due to incorrect parameter passed).

Signed-off-by: Andrey Tsyvarev <tsyvarev@ispras.ru>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
  • Loading branch information
Andrey Tsyvarev authored and Rusty Russell committed Feb 6, 2015
1 parent 5d8591b commit de96d79
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions kernel/module.c
Original file line number Diff line number Diff line change
Expand Up @@ -3356,6 +3356,9 @@ static int load_module(struct load_info *info, const char __user *uargs,
module_bug_cleanup(mod);
mutex_unlock(&module_mutex);

/* Free lock-classes: */
lockdep_free_key_range(mod->module_core, mod->core_size);

/* we can't deallocate the module until we clear memory protection */
unset_module_init_ro_nx(mod);
unset_module_core_ro_nx(mod);
Expand Down

0 comments on commit de96d79

Please sign in to comment.