NetBSD-Bugs archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: install/50357: Erroneous attempt to load booted file-system's module
The following reply was made to PR install/50357; it has been noted by GNATS.
From: Paul Goyette <paul%whooppee.com@localhost>
To: gnats-bugs%NetBSD.org@localhost
Cc:
Subject: Re: install/50357: Erroneous attempt to load booted file-system's
module
Date: Fri, 10 Jun 2016 10:30:59 +0800 (PHT)
And, here's a copy of the patch in plain-text:
Index: kern_module.c
===================================================================
RCS file: /cvsroot/src/sys/kern/kern_module.c,v
retrieving revision 1.110
diff -u -p -r1.110 kern_module.c
--- kern_module.c 6 Feb 2016 22:48:07 -0000 1.110
+++ kern_module.c 10 Jun 2016 02:22:55 -0000
@@ -1235,7 +1235,9 @@ module_do_unload(const char *name, bool
int
module_prime(const char *name, void *base, size_t size)
{
+ __link_set_decl(modules, modinfo_t);
module_t *mod;
+ modinfo_t *const *mip;
int error;
mod = module_newmodule(MODULE_SOURCE_BOOT);
@@ -1243,6 +1245,16 @@ module_prime(const char *name, void *bas
return ENOMEM;
}
+ /* Check for duplicate modules */
+
+ __link_set_foreach(mip, modules) {
+ if (strcmp((*mip)->mi_name, name) == 0) {
+ module_print("Module `%s' pushed by boot loader "
+ "already exists.", name);
+ return EEXIST;
+ }
+ }
+
error = kobj_load_mem(&mod->mod_kobj, name, base, size);
if (error != 0) {
kmem_free(mod, sizeof(*mod));
@@ -1254,8 +1266,8 @@ module_prime(const char *name, void *bas
if (error != 0) {
kobj_unload(mod->mod_kobj);
kmem_free(mod, sizeof(*mod));
- module_error("unable to load `%s' pushed by boot loader, "
- "error %d", name, error);
+ module_error("unable to fetch_info for `%s' pushed by boot "
+ "loader, error %d", name, error);
return error;
}
+------------------+--------------------------+------------------------+
| Paul Goyette | PGP Key fingerprint: | E-mail addresses: |
| (Retired) | FA29 0E3B 35AF E8AE 6651 | paul at whooppee.com |
| Kernel Developer | 0786 F758 55DE 53BA 7731 | pgoyette at netbsd.org |
+------------------+--------------------------+------------------------+
Home |
Main Index |
Thread Index |
Old Index