DragonFly bugs List (threaded) for 2007-07
DragonFly BSD
DragonFly bugs List (threaded) for 2007-07
[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]

Re: [issue747] Kernel Core dumps whrn loading snd_ich


From: "Simon 'corecode' Schubert" <corecode@xxxxxxxxxxxx>
Date: Sun, 29 Jul 2007 12:03:52 +0200

Wesley Hearn wrote:
#12 0xc02fc04e in devclass_get_maxunit (dc=0x0)
at /usr/src/sys/kern/subr_bus.c:363
#13 0xc6e8c16b in dsp_get_info (dev=0x0)
at /usr/src/sys/dev/sound/pcm/dsp.c:71
#14 0xc6e92311 in vchanvolume(i_dev=0x0, write=0, volume=0xc6e7990c, ret=0xc6e798dc, td=0xc6594e00)
at /usr/src/sys/dev/sound/pcm/mixer.c:587
. ..
#27 0xc02fcf73 in device_probe_and_attach (dev=0xc622bbb8)
at /usr/src/sys/kern/subr_bus.c:1114
#28 0xc02fe8ef in bus_generic_driver_added (dev=0xc622b858, driver=0xc6e7e210)
at /usr/src/sys/kern/subr_bus.c:2095
#29 0xc02fbde1 in devclass_add_driver (dc=0xc0ad9020, driver=0xc6e7e210) at bus_if.h:71
#30 0xc02ffdad in driver_module_handler (mod=0xc6224d20,
what=-957881840, arg=0xc6e7e228) at /usr/src/sys/kern/subr_bus.c:2621
#31 0xc02cd6f8 in module_register_init (arg=0xc6e7e23c)
at /usr/src/sys/kern/kern_module.c:110

So the problem is:


module_register_init calls devclass_add_driver first, before setting up the devclass pointer. This one however gets used lateron in the driver attachment.

I believe the correct sequence is this, but I'd appreciate if somebody could double check. The patch fixes the panic, of course.

cheers
 simon

--
Serve - BSD     +++  RENT this banner advert  +++    ASCII Ribbon   /"\
Work - Mac      +++  space for low €€€ NOW!1  +++      Campaign     \ /
Party Enjoy Relax   |   http://dragonflybsd.org      Against  HTML   \
Dude 2c 2 the max   !   http://golden-apple.biz       Mail + News   / \
Index: kern/subr_bus.c
===================================================================
RCS file: /home/dcvs/src/sys/kern/subr_bus.c,v
retrieving revision 1.38
diff -u -p -r1.38 subr_bus.c
--- kern/subr_bus.c	5 May 2007 16:52:55 -0000	1.38
+++ kern/subr_bus.c	29 Jul 2007 09:23:09 -0000
@@ -2618,9 +2618,6 @@ 
 		driver = dmd->dmd_driver;
 		PDEBUG(("Loading module: driver %s on bus %s",
 		        DRIVERNAME(driver), dmd->dmd_busname));
-		error = devclass_add_driver(bus_devclass, driver);
-		if (error)
-			break;
 
 		/*
 		 * If the driver has any base classes, make the
@@ -2633,8 +2630,12 @@ 		if (driver->baseclasses)
 			parentname = driver->baseclasses[0]->name;
 		else
 			parentname = NULL;
-	    	*dmd->dmd_devclass = devclass_find_internal(driver->name,
+		*dmd->dmd_devclass = devclass_find_internal(driver->name,
 							    parentname, TRUE);
+
+		error = devclass_add_driver(bus_devclass, driver);
+		if (error)
+			break;
 		break;
 
 	case MOD_UNLOAD:


[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]