Date: Wed, 30 Apr 2003 04:50:17 -0700 (PDT) From: Dmitry Sivachenko <demon@FreeBSD.org> To: freebsd-bugs@FreeBSD.org Subject: Re: kern/48759: kldstat shows module after unsuccessfull kldload Message-ID: <200304301150.h3UBoH7T026013@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
The following reply was made to PR kern/48759; it has been noted by GNATS. From: Dmitry Sivachenko <demon@FreeBSD.org> To: freebsd-gnats-submit@FreeBSD.org Cc: pawmal@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;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200304301150.h3UBoH7T026013>