From owner-freebsd-usb@FreeBSD.ORG Mon Mar 17 14:40:34 2008 Return-Path: Delivered-To: usb@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B1AC31065672 for ; Mon, 17 Mar 2008 14:40:34 +0000 (UTC) (envelope-from ndenev@gmail.com) Received: from wr-out-0506.google.com (wr-out-0506.google.com [64.233.184.227]) by mx1.freebsd.org (Postfix) with ESMTP id 66E768FC34 for ; Mon, 17 Mar 2008 14:40:34 +0000 (UTC) (envelope-from ndenev@gmail.com) Received: by wr-out-0506.google.com with SMTP id 50so3821296wra.13 for ; Mon, 17 Mar 2008 07:40:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:sender:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references:x-google-sender-auth; bh=z3UXO7TdMXiaj4wFqzJK8WP//IpKJb2IZ1PvogaprqA=; b=BmbJGxCDVOtFafjo4kk3zm3vjO0lTNyfWRcBac5epxf97aZb+LYn3GTpag4K8vexq+sn9KG4sjZeSuTKAL36R9NtQTTu4B84m4iYs4v9ryzAQ3m3tYu5Unli6oc/EIdJn9UAQ0fo8+8x9YiEnYsYLWCnEox8xwS3gHH6++sWlt4= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:sender:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references:x-google-sender-auth; b=m8MnZi2tNgGt5SOEwZOqLwichpDz/bmYMOWNBQ0w2TuL5wL79ggqIuT1RKFIwFAOlmLL3uxeHDCYsV2LubTCRMETetAF9A7T9quxkmb3OrAAA/6R/x/VtBzFVM3FRyZkmJWyYZhLZf5QV0gaB2foMU09fjskFkuwROoz6CmsE+I= Received: by 10.140.173.15 with SMTP id v15mr146967rve.168.1205763251201; Mon, 17 Mar 2008 07:14:11 -0700 (PDT) Received: by 10.140.207.1 with HTTP; Mon, 17 Mar 2008 07:14:11 -0700 (PDT) Message-ID: <2e77fc10803170714p1327b7dck9c05877a421871e2@mail.gmail.com> Date: Mon, 17 Mar 2008 16:14:11 +0200 From: "Niki Denev" Sender: ndenev@gmail.com To: "Marcin Cieslak" In-Reply-To: <200803160315.m2G3FhNu014253@radziecki.saper.info> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <200803160315.m2G3FhNu014253@radziecki.saper.info> X-Google-Sender-Auth: ec7a58160ddf7e92 Cc: usb@freebsd.org, FreeBSD-gnats-submit@freebsd.org Subject: Re: usb/121755: [patch] Fix panic after ohci/uhub cardbus device eject X-BeenThere: freebsd-usb@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: FreeBSD support for USB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Mar 2008 14:40:34 -0000 On Sun, Mar 16, 2008 at 5:15 AM, Marcin Cieslak wrote: > > >Number: 121755 > >Category: usb > >Synopsis: [patch] Fix panic after ohci/uhub cardbus device eject > >Confidential: no > >Severity: critical > >Priority: high > >Responsible: freebsd-usb > >State: open > >Quarter: > >Keywords: > >Date-Required: > >Class: sw-bug > >Submitter-Id: current-users > >Arrival-Date: Sun Mar 16 03:20:02 UTC 2008 > >Closed-Date: > >Last-Modified: > >Originator: Marcin Cieslak > >Release: FreeBSD 7.0-PRERELEASE amd64 > >Organization: > >Environment: > System: FreeBSD radziecki.saper.info 7.0-PRERELEASE FreeBSD 7.0-PRERELEASE #9: Sat Jan 26 01:36:13 CET 2008 saper@radziecki.saper.info:/usr/obj/usr/src/sys/VAIO amd64 > > >Description: > > When ejecting Cardbus card implementing OHCI inteface, one may get > > panic: ohci_rem_ed: ED not found > > or > > ucom0: detached > (null): at uhub4 port 1 (addr 2) disconnected > > Fatal trap 12: page fault while in kernel mode > fault virtual address = 0x400 > fault code = supervisor read, page not present > instruction pointer = 0x20:0xc0661e84 > stack pointer = 0x28:0xd4d63b4c > frame pointer = 0x28:0xd4d63b6c > code segment = base 0x0, limit 0xfffff, type 0x1b > = DPL 0, pres 1, def32 1, gran 1 > processor eflags = interrupt enabled, resume, IOPL = 0 > current process = 31 (cbb0 event thread) > [thread pid 31 tid 100027 ] > Stopped at kobj_delete+0x14: movl 0x400(%eax),%ebx > > when unplugging the device, as reported in this thread: > > http://thread.gmane.org/gmane.os.freebsd.current/92196 > http://thread.gmane.org/gmane.os.freebsd.current/92196/focus=100202 > > > > >How-To-Repeat: > > Try removing Option GTMAX 7.2 3G UMTS modem device (also reported with HUAWEI > datacards). > > >Fix: > > First patch fixes the ohci_rem_ed panic, the next one fixes the kobj_delete > problem. > > Index: ohci_pci.c > =================================================================== > RCS file: /usr/home/ncvs/src/sys/dev/usb/ohci_pci.c,v > retrieving revision 1.50 > diff -u -u -r1.50 ohci_pci.c > --- ohci_pci.c 21 Jun 2007 14:42:33 -0000 1.50 > +++ ohci_pci.c 16 Mar 2008 01:33:07 -0000 > @@ -348,6 +348,11 @@ > { > ohci_softc_t *sc = device_get_softc(self); > > + if (sc->sc_bus.bdev) { > + device_delete_child(self, sc->sc_bus.bdev); > + sc->sc_bus.bdev = NULL; > + } > + > if (sc->sc_flags & OHCI_SCFLG_DONEINIT) { > ohci_detach(sc, 0); > sc->sc_flags &= ~OHCI_SCFLG_DONEINIT; > @@ -367,10 +372,6 @@ > err); > sc->ih = NULL; > } > - if (sc->sc_bus.bdev) { > - device_delete_child(self, sc->sc_bus.bdev); > - sc->sc_bus.bdev = NULL; > - } > if (sc->irq_res) { > bus_release_resource(self, SYS_RES_IRQ, 0, sc->irq_res); > sc->irq_res = NULL; > Index: usb_subr.c > =================================================================== > RCS file: /usr/home/ncvs/src/sys/dev/usb/usb_subr.c,v > retrieving revision 1.95 > diff -u -u -r1.95 usb_subr.c > --- usb_subr.c 30 Jun 2007 20:18:44 -0000 1.95 > +++ usb_subr.c 16 Mar 2008 02:51:05 -0000 > @@ -1379,8 +1379,6 @@ > device_get_ivars(dev->subdevs[i]); > device_detach(dev->subdevs[i]); > free(uaap, M_USB); > - device_delete_child(device_get_parent(dev->subdevs[i]), > - dev->subdevs[i]); > dev->subdevs[i] = NULL; > } > } > > >Release-Note: > >Audit-Trail: > >Unformatted: Thanks, my machine can now survice Huawei E630 insert and removal. --Niki