kern/48759: kldstat shows module after unsuccessfull kldload
Dmitry Sivachenko
demon at FreeBSD.org
Wed Apr 30 04:50:18 PDT 2003
The following reply was made to PR kern/48759; it has been noted by GNATS.
From: Dmitry Sivachenko <demon at FreeBSD.org>
To: freebsd-gnats-submit at FreeBSD.org
Cc: pawmal at unia.3lo.lublin.pl
Subject: Re: kern/48759: kldstat shows module after unsuccessfull kldload
Date: Wed, 30 Apr 2003 15:46:52 +0400
Here is possible fix:
For -stable:
--- /sys/kern/kern_linker.c Wed Nov 21 20:50:35 2001
+++ kern_linker.c Wed Apr 30 14:31:25 2003
@@ -286,6 +286,14 @@ linker_load_file(const char* filename, l
if (lf) {
linker_file_register_sysctls(lf);
error = linker_file_sysinit(lf);
+ if (error) {
+ /*
+ * Unset LINKER_FILE_LINKED flag so SYSUNINITs are not
+ * executed because of error in linker_file_sysinit() above.
+ */
+ lf->flags &= ~LINKER_FILE_LINKED;
+ (void)linker_file_unload(lf);
+ }
*result = lf;
goto out;
for -current:
--- kern_linker.c.orig Wed Apr 30 14:53:49 2003
+++ kern_linker.c Wed Apr 30 15:36:52 2003
@@ -297,9 +297,11 @@ linker_file_register_modules(linker_file
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);
}
@@ -351,7 +353,11 @@ linker_load_file(const char *filename, l
if (error != ENOENT)
foundfile = 1;
if (lf) {
- linker_file_register_modules(lf);
+ error = linker_file_register_modules(lf);
+ if (error == EEXIST) {
+ (void)linker_file_unload(lf);
+ goto out;
+ }
linker_file_register_sysctls(lf);
linker_file_sysinit(lf);
lf->flags |= LINKER_FILE_LINKED;
More information about the freebsd-bugs
mailing list