OSDN Git Service

powerpc/pseries: Allow not having ibm, hypertas-functions::hcall-multi-tce for DDW
[sagit-ice-cold/kernel_xiaomi_msm8998.git] / kernel / module.c
index 0a56098..2f695b6 100644 (file)
@@ -1014,6 +1014,8 @@ SYSCALL_DEFINE2(delete_module, const char __user *, name_user,
        strlcpy(last_unloaded_module, mod->name, sizeof(last_unloaded_module));
 
        free_module(mod);
+       /* someone could wait for the module in add_unformed_module() */
+       wake_up_all(&module_wq);
        return 0;
 out:
        mutex_unlock(&module_mutex);
@@ -2869,6 +2871,15 @@ static struct module *setup_load_info(struct load_info *info, int flags)
        return mod;
 }
 
+static void check_modinfo_retpoline(struct module *mod, struct load_info *info)
+{
+       if (retpoline_module_ok(get_modinfo(info, "retpoline")))
+               return;
+
+       pr_warn("%s: loading module not compiled with retpoline compiler.\n",
+               mod->name);
+}
+
 static int check_modinfo(struct module *mod, struct load_info *info, int flags)
 {
        const char *modmagic = get_modinfo(info, "vermagic");
@@ -2895,6 +2906,8 @@ static int check_modinfo(struct module *mod, struct load_info *info, int flags)
                add_taint_module(mod, TAINT_OOT_MODULE, LOCKDEP_STILL_OK);
        }
 
+       check_modinfo_retpoline(mod, info);
+
        if (get_modinfo(info, "staging")) {
                add_taint_module(mod, TAINT_CRAP, LOCKDEP_STILL_OK);
                pr_warn("%s: module is from the staging directory, the quality "
@@ -3214,8 +3227,7 @@ static bool finished_loading(const char *name)
        sched_annotate_sleep();
        mutex_lock(&module_mutex);
        mod = find_module_all(name, strlen(name), true);
-       ret = !mod || mod->state == MODULE_STATE_LIVE
-               || mod->state == MODULE_STATE_GOING;
+       ret = !mod || mod->state == MODULE_STATE_LIVE;
        mutex_unlock(&module_mutex);
 
        return ret;
@@ -3374,8 +3386,7 @@ again:
        mutex_lock(&module_mutex);
        old = find_module_all(mod->name, strlen(mod->name), true);
        if (old != NULL) {
-               if (old->state == MODULE_STATE_COMING
-                   || old->state == MODULE_STATE_UNFORMED) {
+               if (old->state != MODULE_STATE_LIVE) {
                        /* Wait in case it fails to load. */
                        mutex_unlock(&module_mutex);
                        err = wait_event_interruptible(module_wq,
@@ -3849,7 +3860,7 @@ static unsigned long mod_find_symname(struct module *mod, const char *name)
 
        for (i = 0; i < kallsyms->num_symtab; i++)
                if (strcmp(name, symname(kallsyms, i)) == 0 &&
-                   kallsyms->symtab[i].st_info != 'U')
+                   kallsyms->symtab[i].st_shndx != SHN_UNDEF)
                        return kallsyms->symtab[i].st_value;
        return 0;
 }
@@ -3895,6 +3906,10 @@ int module_kallsyms_on_each_symbol(int (*fn)(void *, const char *,
                if (mod->state == MODULE_STATE_UNFORMED)
                        continue;
                for (i = 0; i < kallsyms->num_symtab; i++) {
+
+                       if (kallsyms->symtab[i].st_shndx == SHN_UNDEF)
+                               continue;
+
                        ret = fn(data, symname(kallsyms, i),
                                 mod, kallsyms->symtab[i].st_value);
                        if (ret != 0)