After cvsup at 2002/01/29, I met kernel page fault when 
detaching USB hub. 
My USB configuration is same as I reported once in -current ML
message id <[EMAIL PROTECTED]>.

With vmcore and gdb I found the page fault occurs at 
usb_add_event() in /sys/dev/usb/usb.c(1.53 2002/01/28), line 690: 
        TAILQ_INSERT_TAIL(&usb_events, ueq, next);
In "for" loop just above the line, ueq seems to be set to NULL
but TAILQ_INSERT_TAIL assumes that ueq is non-NULL. 
I changed the code to avoid "for" loop and now my system works fine. 

However, this fault doesn't occur when detaching USB mice or 
keyboards, so I guess it's not a good solution to patch usb.c. 
Any ideas and suggestions are appreciated. 

FUJIMOTO Kou, Dept. of Information Sciences, Tokyo Denki Univ.
--- src/sys/dev/usb/usb.c.orig  Fri Feb  1 18:25:06 2002
+++ src/sys/dev/usb/usb.c       Sat Feb  2 02:07:49 2002
@@ -670,7 +670,7 @@
        TIMEVAL_TO_TIMESPEC(&thetime, &ueq->ue.ue_time);
        s = splusb();
-       if (USB_EVENT_IS_DETACH(type)) {
+       if (USB_EVENT_IS_DETACH(type) && TAILQ_FIRST(&usb_events) != NULL) {
                for (ueq = TAILQ_FIRST(&usb_events); ueq; ueq = ueq_next) {
                        ueq_next = TAILQ_NEXT(ueq, next);
                        if (ueq->ue.u.ue_driver.ue_cookie.cookie ==

Reply via email to