Merge tag 'modules-for-v5.6' of git://git.kernel.org/pub/scm/linux/kernel/git/jeyu...
[linux-2.6-microblaze.git] / kernel / module.c
index ac058a5..90ec5ab 100644 (file)
@@ -214,7 +214,8 @@ static struct module *mod_find(unsigned long addr)
 {
        struct module *mod;
 
-       list_for_each_entry_rcu(mod, &modules, list) {
+       list_for_each_entry_rcu(mod, &modules, list,
+                               lockdep_is_held(&module_mutex)) {
                if (within_module(addr, mod))
                        return mod;
        }
@@ -448,7 +449,8 @@ bool each_symbol_section(bool (*fn)(const struct symsearch *arr,
        if (each_symbol_in_section(arr, ARRAY_SIZE(arr), NULL, fn, data))
                return true;
 
-       list_for_each_entry_rcu(mod, &modules, list) {
+       list_for_each_entry_rcu(mod, &modules, list,
+                               lockdep_is_held(&module_mutex)) {
                struct symsearch arr[] = {
                        { mod->syms, mod->syms + mod->num_syms, mod->crcs,
                          NOT_GPL_ONLY, false },
@@ -616,7 +618,8 @@ static struct module *find_module_all(const char *name, size_t len,
 
        module_assert_mutex_or_preempt();
 
-       list_for_each_entry_rcu(mod, &modules, list) {
+       list_for_each_entry_rcu(mod, &modules, list,
+                               lockdep_is_held(&module_mutex)) {
                if (!even_unformed && mod->state == MODULE_STATE_UNFORMED)
                        continue;
                if (strlen(mod->name) == len && !memcmp(mod->name, name, len))
@@ -1781,6 +1784,8 @@ static int module_add_modinfo_attrs(struct module *mod)
 error_out:
        if (i > 0)
                module_remove_modinfo_attrs(mod, --i);
+       else
+               kfree(mod->modinfo_attrs);
        return error;
 }
 
@@ -2834,7 +2839,7 @@ static int module_sig_check(struct load_info *info, int flags)
                reason = "Loading of module with unavailable key";
        decide:
                if (is_module_sig_enforced()) {
-                       pr_notice("%s is rejected\n", reason);
+                       pr_notice("%s: %s is rejected\n", info->name, reason);
                        return -EKEYREJECTED;
                }
 
@@ -3011,9 +3016,7 @@ static int setup_load_info(struct load_info *info, int flags)
 
        /* Try to find a name early so we can log errors with a module name */
        info->index.info = find_sec(info, ".modinfo");
-       if (!info->index.info)
-               info->name = "(missing .modinfo section)";
-       else
+       if (info->index.info)
                info->name = get_modinfo(info, "name");
 
        /* Find internal symbols and strings. */
@@ -3028,14 +3031,15 @@ static int setup_load_info(struct load_info *info, int flags)
        }
 
        if (info->index.sym == 0) {
-               pr_warn("%s: module has no symbols (stripped?)\n", info->name);
+               pr_warn("%s: module has no symbols (stripped?)\n",
+                       info->name ?: "(missing .modinfo section or name field)");
                return -ENOEXEC;
        }
 
        info->index.mod = find_sec(info, ".gnu.linkonce.this_module");
        if (!info->index.mod) {
                pr_warn("%s: No module found in object\n",
-                       info->name ?: "(missing .modinfo name field)");
+                       info->name ?: "(missing .modinfo section or name field)");
                return -ENOEXEC;
        }
        /* This is temporary: point mod into copy of data. */