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
Unified · Split
| @@ -1842,7 +1842,9 @@ static void free_module(struct module *mod) · 1841 unmodified lines | ||
| 1842 | 1842 | |
| 1843 | 1843 | /* We leave it in list to prevent duplicate loads, but make sure |
| 1844 | 1844 | * that noone uses it while it's being deconstructed. */ |
| 1845 | + mutex_lock(&module_mutex); | |
| 1845 | 1846 | mod->state = MODULE_STATE_UNFORMED; |
| 1847 | + mutex_unlock(&module_mutex); | |
| 1846 | 1848 | |
| 1847 | 1849 | /* Remove dynamic debug info */ |
| 1848 | 1850 | ddebug_remove_module(mod->name); |