Merge tag 'brcmstb-smp-uart-for-3.19' of http://github.com/brcm/linux into next/soc
[cascardo/linux.git] / kernel / module.c
index 65586ff..88cec1d 100644 (file)
@@ -1842,7 +1842,9 @@ static void free_module(struct module *mod)
 
        /* We leave it in list to prevent duplicate loads, but make sure
         * that noone uses it while it's being deconstructed. */
+       mutex_lock(&module_mutex);
        mod->state = MODULE_STATE_UNFORMED;
+       mutex_unlock(&module_mutex);
 
        /* Remove dynamic debug info */
        ddebug_remove_module(mod->name);