diff options
Diffstat (limited to 'kernel/module.c')
-rw-r--r-- | kernel/module.c | 21 |
1 files changed, 5 insertions, 16 deletions
diff --git a/kernel/module.c b/kernel/module.c index db0ead0363e2..35246a61a7e9 100644 --- a/kernel/module.c +++ b/kernel/module.c | |||
@@ -692,8 +692,7 @@ sys_delete_module(const char __user *name_user, unsigned int flags) | |||
692 | } | 692 | } |
693 | 693 | ||
694 | /* If it has an init func, it must have an exit func to unload */ | 694 | /* If it has an init func, it must have an exit func to unload */ |
695 | if ((mod->init != NULL && mod->exit == NULL) | 695 | if (mod->init && !mod->exit) { |
696 | || mod->unsafe) { | ||
697 | forced = try_force_unload(flags); | 696 | forced = try_force_unload(flags); |
698 | if (!forced) { | 697 | if (!forced) { |
699 | /* This module can't be removed */ | 698 | /* This module can't be removed */ |
@@ -741,11 +740,6 @@ static void print_unload_info(struct seq_file *m, struct module *mod) | |||
741 | seq_printf(m, "%s,", use->module_which_uses->name); | 740 | seq_printf(m, "%s,", use->module_which_uses->name); |
742 | } | 741 | } |
743 | 742 | ||
744 | if (mod->unsafe) { | ||
745 | printed_something = 1; | ||
746 | seq_printf(m, "[unsafe],"); | ||
747 | } | ||
748 | |||
749 | if (mod->init != NULL && mod->exit == NULL) { | 743 | if (mod->init != NULL && mod->exit == NULL) { |
750 | printed_something = 1; | 744 | printed_something = 1; |
751 | seq_printf(m, "[permanent],"); | 745 | seq_printf(m, "[permanent],"); |
@@ -2011,15 +2005,10 @@ sys_init_module(void __user *umod, | |||
2011 | buggy refcounters. */ | 2005 | buggy refcounters. */ |
2012 | mod->state = MODULE_STATE_GOING; | 2006 | mod->state = MODULE_STATE_GOING; |
2013 | synchronize_sched(); | 2007 | synchronize_sched(); |
2014 | if (mod->unsafe) | 2008 | module_put(mod); |
2015 | printk(KERN_ERR "%s: module is now stuck!\n", | 2009 | mutex_lock(&module_mutex); |
2016 | mod->name); | 2010 | free_module(mod); |
2017 | else { | 2011 | mutex_unlock(&module_mutex); |
2018 | module_put(mod); | ||
2019 | mutex_lock(&module_mutex); | ||
2020 | free_module(mod); | ||
2021 | mutex_unlock(&module_mutex); | ||
2022 | } | ||
2023 | return ret; | 2012 | return ret; |
2024 | } | 2013 | } |
2025 | 2014 | ||