summaryrefslogtreecommitdiff
path: root/kernel/module.c
diff options
context:
space:
mode:
authorAndrey Tsyvarev <tsyvarev@ispras.ru>2015-02-06 15:09:57 +1030
committerRusty Russell <rusty@rustcorp.com.au>2015-02-06 15:31:40 +1030
commitde96d79f343321d26ff920af25fcefe6895ca544 (patch)
treee614ee846061655156e2ec93922e1e7bcefc6ab2 /kernel/module.c
parent5d8591bc0fbaeb6deda6ee478577e9c4d9b10c2b (diff)
kernel/module.c: Free lock-classes if parse_args failed
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>
Diffstat (limited to 'kernel/module.c')
-rw-r--r--kernel/module.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/kernel/module.c b/kernel/module.c
index d856e96a3cce..441ed3fc9c89 100644
--- a/kernel/module.c
+++ b/kernel/module.c
@@ -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);