public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] kernel/module.c: Free lock-classes if parse_args failed
@ 2015-01-14  6:25 Andrey Tsyvarev
  2015-01-20  6:37 ` Rusty Russell
  0 siblings, 1 reply; 11+ messages in thread
From: Andrey Tsyvarev @ 2015-01-14  6:25 UTC (permalink / raw)
  To: Rusty Russell; +Cc: Andrey Tsyvarev, linux-kernel

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>
---
 kernel/module.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/kernel/module.c b/kernel/module.c
index 3965511..2b44de4 100644
--- a/kernel/module.c
+++ b/kernel/module.c
@@ -3311,6 +3311,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);
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2015-02-19 12:24 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-01-14  6:25 [PATCH] kernel/module.c: Free lock-classes if parse_args failed Andrey Tsyvarev
2015-01-20  6:37 ` Rusty Russell
2015-01-20  7:47   ` Andrey Tsyvarev
2015-01-21  1:40     ` Rusty Russell
2015-01-21 10:49       ` Andrey Tsyvarev
2015-01-22  0:40         ` Rusty Russell
2015-01-22  9:27           ` Andrey Tsyvarev
2015-01-20  9:48   ` Peter Zijlstra
2015-02-19  0:12     ` Ingo Molnar
2015-02-19 11:57       ` Peter Zijlstra
2015-02-19 12:24         ` Ingo Molnar

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox