aboutsummaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
Diffstat (limited to 'kernel')
-rw-r--r--kernel/module.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/kernel/module.c b/kernel/module.c
index d2d093e74165..8674a390a2e8 100644
--- a/kernel/module.c
+++ b/kernel/module.c
@@ -745,12 +745,13 @@ sys_delete_module(const char __user *name_user, unsigned int flags)
745 if (!forced && module_refcount(mod) != 0) 745 if (!forced && module_refcount(mod) != 0)
746 wait_for_zero_refcount(mod); 746 wait_for_zero_refcount(mod);
747 747
748 mutex_unlock(&module_mutex);
748 /* Final destruction now noone is using it. */ 749 /* Final destruction now noone is using it. */
749 if (mod->exit != NULL) { 750 if (mod->exit != NULL)
750 mutex_unlock(&module_mutex);
751 mod->exit(); 751 mod->exit();
752 mutex_lock(&module_mutex); 752 blocking_notifier_call_chain(&module_notify_list,
753 } 753 MODULE_STATE_GOING, mod);
754 mutex_lock(&module_mutex);
754 /* Store the name of the last unloaded module for diagnostic purposes */ 755 /* Store the name of the last unloaded module for diagnostic purposes */
755 strlcpy(last_unloaded_module, mod->name, sizeof(last_unloaded_module)); 756 strlcpy(last_unloaded_module, mod->name, sizeof(last_unloaded_module));
756 free_module(mod); 757 free_module(mod);
@@ -2191,6 +2192,8 @@ sys_init_module(void __user *umod,
2191 mod->state = MODULE_STATE_GOING; 2192 mod->state = MODULE_STATE_GOING;
2192 synchronize_sched(); 2193 synchronize_sched();
2193 module_put(mod); 2194 module_put(mod);
2195 blocking_notifier_call_chain(&module_notify_list,
2196 MODULE_STATE_GOING, mod);
2194 mutex_lock(&module_mutex); 2197 mutex_lock(&module_mutex);
2195 free_module(mod); 2198 free_module(mod);
2196 mutex_unlock(&module_mutex); 2199 mutex_unlock(&module_mutex);