Fix a bug in the kernel module runtime linker that made it impossible

to unload the usb.ko module after boot if it was originally preloaded
from "/boot/loader.conf".  When processing preloaded modules, the
linker erroneously added self-dependencies the each module's reference
count.  That prevented usb.ko's reference count from ever going to 0,
so it could not be unloaded.

Sponsored by Isilon Systems.

Reviewed by:	pjd, peter
MFC after:	1 week
This commit is contained in:
jdp 2005-10-19 20:40:30 +00:00
parent 32a93330de
commit a3d0544135

View File

@ -1337,6 +1337,9 @@ linker_preload(void *arg)
modname = mp->md_cval;
verinfo = mp->md_data;
mod = modlist_lookup2(modname, verinfo);
/* Don't count self-dependencies */
if (lf == mod->container)
continue;
mod->container->refs++;
error = linker_file_add_dependency(lf,
mod->container);