Bug 30683

Summary: [PATCH] loader(8) fails to load module which has dependencies
Product: Base System Reporter: HARASHINO Makoto <harashi>
Component: miscAssignee: freebsd-bugs (Nobody) <bugs>
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: 1.0-RELEASE   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
file.diff none

Description HARASHINO Makoto 2001-09-20 13:30:01 UTC
When loader(8) try to load module which has dependencies
if the dependencies already loaded, invalidate the whole.

Fix: Apply patch included below.
How-To-Repeat: try this in the /boot/loader command line

    load miibus
    load if_xl

or

    load snd_pcm
    load snd_ds1

and so on.
Comment 1 tada 2002-05-18 20:23:17 UTC
Hi,

(I'm writing this mail in the hope of attracting committer's
interest to this PR misc/30683...)

I suffered from a loader(8) problem in RELENG_4 and fixed it myself,
not having realized that the problem has been already filed as a PR
by Harashino-san.

My fix is similar to Harashino-san's, but it looks simpler, as
attached below.

Index: module.c
===================================================================
RCS file: /usr/ncvs/src/sys/boot/common/module.c,v
retrieving revision 1.13.2.3
diff -u -r1.13.2.3 module.c
--- module.c	12 Jun 2001 15:35:14 -0000	1.13.2.3
+++ module.c	13 Mar 2002 03:08:03 -0000
@@ -363,18 +363,17 @@
     md = mod_findmetadata(base_file, MODINFOMD_DEPLIST);
     if (md == NULL)
 	return (0);
-    error = 0;
     do {
 	dmodname = (char *)md->md_data;
 	if (mod_findmodule(NULL, dmodname) == NULL) {
 	    printf("loading required module '%s'\n", dmodname);
 	    error = mod_load(dmodname, 0, NULL);
 	    if (error && error != EEXIST)
-		break;
+		return (error);
 	}
 	md = metadata_next(md, MODINFOMD_DEPLIST);
     } while (md);
-    return (error);
+    return (0);
 }
 
 /*


While Harashino-san's patch in PR misc/30683 also modifies what string
will be passed to mod_findmodule() by strcat'ing dmodname with ".ko",
I don't see why this is needed. Perhaps there might be something I'm
overlooking.

I'd appreciate it if someone would give any comments to my patch
above and/or point me to any information I'm overlooking.

Thanks,
Tadaaki Nagao <tada@rr.iij4u.or.jp>
Comment 2 Thomas Quinot freebsd_committer freebsd_triage 2002-12-19 12:43:40 UTC
State Changed
From-To: open->closed

A slightly different fix was committed as sys/boot/common/module.c 
rev. 1.13.2.4.