Summary: | kldunload rtc.ko causes a panic; yet it's in rc.d script | ||
---|---|---|---|
Product: | Ports & Packages | Reporter: | Jan Srzednicki <w> |
Component: | Individual Port(s) | Assignee: | silby |
Status: | Closed FIXED | ||
Severity: | Affects Only Me | ||
Priority: | Normal | ||
Version: | Latest | ||
Hardware: | Any | ||
OS: | Any |
Description
Jan Srzednicki
2003-10-01 17:50:17 UTC
The bug is that the module, on unloading, calls destroy_dev() twice for its device. Doing this causes a panic. Fix: --- ports/emulators/rtc/files/rtc.c_orig Thu Oct 2 10:20:17 2003 +++ ports/emulators/rtc/files/rtc.c Thu Oct 2 09:58:13 2003 @@ -168,7 +168,6 @@ if (sc->var.flags.opened) { return EBUSY; } - destroy_dev(sc->dev); FREE(sc, M_DEVBUF); return error; } Responsible Changed From-To: freebsd-ports-bugs->freebsd-emulation Over to the maintainer group. I ran into this some time ago, and found that you get different results depending on whether the device has been opened or not. Have you tried kldunloading "rtc" w/o using it first, e.g. directly after boot? I've been using the following patch for a while: --- rtc.c.org Wed Aug 20 20:41:50 2003 +++ rtc.c Thu Oct 2 08:40:37 2003 @@ -299,7 +299,8 @@ DLog(Lfail, "%p busy", sc); return error; } - destroy_dev(rtc_dev); + if (sc == NULL) + destroy_dev(rtc_dev); #if __FreeBSD_version < 500104 error = cdevsw_remove(&rtc_cdevsw); #endif Which seems to work find for me in all cases. I made a mental note to submit a PR once I've tested out the fix, and then of course, I forgot all about it... :) $.02, /Mikko On Thu, Oct 02, 2003 at 08:45:19AM -0700, Mikko Työläjärvi wrote: > > I ran into this some time ago, and found that you get different > results depending on whether the device has been opened or not. > > Have you tried kldunloading "rtc" w/o using it first, e.g. directly > after boot? > > I've been using the following patch for a while: [snip] > Which seems to work find for me in all cases. I made a mental note to > submit a PR once I've tested out the fix, and then of course, I forgot > all about it... :) This patch doesn't work for me; kldunload rtc still causes a panic. -- Jan 'Winfried' Srzednicki w@expro.pl On Thu, Oct 02, 2003 at 10:24:41AM +0200, Philipp Mergenthaler wrote: > The bug is that the module, on unloading, calls destroy_dev() twice > for its device. Doing this causes a panic. > > Fix: > --- ports/emulators/rtc/files/rtc.c_orig Thu Oct 2 10:20:17 2003 > +++ ports/emulators/rtc/files/rtc.c Thu Oct 2 09:58:13 2003 > @@ -168,7 +168,6 @@ > if (sc->var.flags.opened) { > return EBUSY; > } > - destroy_dev(sc->dev); > FREE(sc, M_DEVBUF); > return error; > } This one seems to work fine. Thanks. ;) -- Jan 'Winfried' Srzednicki w@expro.pl Responsible Changed From-To: freebsd-emulation->emulation Change freebsd-emulation to emulation so that the list only receives one list of open PRs. Responsible Changed From-To: emulation->silby I will fix this and a bunch of other things in the rtc driver in the next week or two. State Changed From-To: open->closed Suggested fix committed. |