summaryrefslogtreecommitdiffstats
path: root/sys/kern/kern_linker.c
diff options
context:
space:
mode:
authorpjd <pjd@FreeBSD.org>2005-05-28 22:29:44 +0000
committerpjd <pjd@FreeBSD.org>2005-05-28 22:29:44 +0000
commit7543a23525813c17b3617c1c5a417f8979b78681 (patch)
tree20473695d44130d20818bc62bee4d46b149e7263 /sys/kern/kern_linker.c
parentd49fabe2d34d8259945ab7881c87cba822473e27 (diff)
downloadFreeBSD-src-7543a23525813c17b3617c1c5a417f8979b78681.zip
FreeBSD-src-7543a23525813c17b3617c1c5a417f8979b78681.tar.gz
Prevent loading modules with are compiled into the kernel.
PR: kern/48759 Submitted by: Pawe³ Ma³achowski <pawmal@unia.3lo.lublin.pl> Patch from: demon MFC after: 2 weeks
Diffstat (limited to 'sys/kern/kern_linker.c')
-rw-r--r--sys/kern/kern_linker.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/sys/kern/kern_linker.c b/sys/kern/kern_linker.c
index 53479e1..32cb32a 100644
--- a/sys/kern/kern_linker.c
+++ b/sys/kern/kern_linker.c
@@ -300,9 +300,11 @@ linker_file_register_modules(linker_file_t lf)
KLD_DPF(FILE, ("Registering module %s in %s\n",
moddata->name, lf->filename));
error = module_register(moddata, lf);
- if (error)
+ if (error) {
printf("Module %s failed to register: %d\n",
moddata->name, error);
+ return (error);
+ }
}
return (0);
}
@@ -354,7 +356,11 @@ linker_load_file(const char *filename, linker_file_t *result)
if (error != ENOENT)
foundfile = 1;
if (lf) {
- linker_file_register_modules(lf);
+ error = linker_file_register_modules(lf);
+ if (error == EEXIST) {
+ linker_file_unload(lf, LINKER_UNLOAD_FORCE);
+ goto out;
+ }
linker_file_register_sysctls(lf);
linker_file_sysinit(lf);
lf->flags |= LINKER_FILE_LINKED;
OpenPOWER on IntegriCloud