浏览代码

Merge tag 'modules-next-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rusty/linux

Pull module fix from Rusty Russell:
 "A single panic fix for a rare race, stable CC'd"

* tag 'modules-next-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rusty/linux:
  modules, lock around setting of MODULE_STATE_UNFORMED
Linus Torvalds 10 年之前
父节点
当前提交
50edb5cc22
共有 1 个文件被更改,包括 2 次插入0 次删除
  1. 2 0
      kernel/module.c

+ 2 - 0
kernel/module.c

@@ -1842,7 +1842,9 @@ static void free_module(struct module *mod)
 
 
 	/* We leave it in list to prevent duplicate loads, but make sure
 	/* We leave it in list to prevent duplicate loads, but make sure
 	 * that noone uses it while it's being deconstructed. */
 	 * that noone uses it while it's being deconstructed. */
+	mutex_lock(&module_mutex);
 	mod->state = MODULE_STATE_UNFORMED;
 	mod->state = MODULE_STATE_UNFORMED;
+	mutex_unlock(&module_mutex);
 
 
 	/* Remove dynamic debug info */
 	/* Remove dynamic debug info */
 	ddebug_remove_module(mod->name);
 	ddebug_remove_module(mod->name);