From owner-freebsd-current Fri Feb 1 20: 0:13 2002 Delivered-To: freebsd-current@freebsd.org Received: from ises00.j.dendai.ac.jp (ises00.j.dendai.ac.jp [133.14.49.10]) by hub.freebsd.org (Postfix) with ESMTP id 51CEA37B416 for ; Fri, 1 Feb 2002 20:00:06 -0800 (PST) Received: from j.dendai.ac.jp (yebisu [133.14.49.224]) by ises00.j.dendai.ac.jp (8.9.3+Sun/8.9.3) with ESMTP id NAA18571 for ; Sat, 2 Feb 2002 13:00:03 +0900 (JST) Message-ID: <3C5B6443.99B2E65A@j.dendai.ac.jp> Date: Sat, 02 Feb 2002 13:00:03 +0900 From: FUJIMOTO Kou Organization: Tokyo Denki University X-Mailer: Mozilla 4.75 [ja] (Windows NT 5.0; U) X-Accept-Language: ja,en MIME-Version: 1.0 To: freebsd-current@freebsd.org Subject: uhub detach causes page fault --- workaround Content-Type: multipart/mixed; boundary="------------25F074E2012D2891DDFFCC59" Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG This is a multi-part message in MIME format. --------------25F074E2012D2891DDFFCC59 Content-Type: text/plain; charset=iso-2022-jp Content-Transfer-Encoding: 7bit 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 <3B677C89.D72AA4C8@j.dendai.ac.jp>. 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. --------------25F074E2012D2891DDFFCC59 Content-Type: text/plain; charset=iso-2022-jp; name="usb.c.patch" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="usb.c.patch" --- 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 == --------------25F074E2012D2891DDFFCC59-- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message