Merge remote-tracking branch 'lsk/v3.10/topic/dma-mapping' into linux-linaro-lsk
[firefly-linux-kernel-4.4.55.git] / kernel / module.c
index fa53db8aadeb2dea6320d1987f0f775e35e480a4..61fb677211cba90d841bf1fab48649d0c4504aaa 100644 (file)
@@ -1866,7 +1866,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);
@@ -3279,6 +3281,9 @@ static int load_module(struct load_info *info, const char __user *uargs,
 
        dynamic_debug_setup(info->debug, info->num_debug);
 
+       /* Ftrace init must be called in the MODULE_STATE_UNFORMED state */
+       ftrace_module_init(mod);
+
        /* Finally it's fully formed, ready to start executing. */
        err = complete_formation(mod, info);
        if (err)