Re: panic when removing pccard

From: Niki Denev <nike_d_at_cytexbg.com>
Date: Mon, 25 Jun 2007 13:15:36 +0300
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Niki Denev wrote:
> M. Warner Losh wrote:
>> I've done some testing with the recently improved in-tree usb stack,
>> and it doesn't panic for me when I remove a CardBus USB card, both
>> with and without devices.  It also does remove the extra /dev/usb*
>> entries properly.  I couldn't cause any crashes with the latest
>> -current.
> 
>> Warner
> 
> Unfortunately it still does panic for me by simply inserting the card
> (Huawei E630 3g card a.k.a Vodafone Mobile Connect), waiting for the
> usb busses to be added and the ucom0 device to be recognized ( it takes
> a few seconds) and then ejecting the card.
> Again the message is :
> 
>   ucom0: detached
>   (null): at uhub2 port 1 (addr 2) disconnected
> 
>   Fatal trap 12: page fault while in kernel mode
>   fault virtual address   = 0x400
>   fault code              = supervisor read, page not presend
>   instruction pointer     = 0x20:0xc0595b2d
>   stack pointer           = 0x28:0xd2f4db34
>   frame pointer           = 0x28:0xd2f4db5c
>   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         = 28 (cbb0 event thread)
>   trap number             = 12
>   panic: page fault
> 
> This problem does not exist if i compile my kernel with the HPS Usb Stack.
> 
> 

I temporarily "fixed" the problem here with this leaking resources :

- --- usb_subr.c  Mon Jun 25 13:09:12 2007
+++ usb_subr.c.ugly     Mon Jun 25 13:03:42 2007
_at__at_ -11,7 +11,7 _at__at_
  */

 #include <sys/cdefs.h>
- -__FBSDID("$FreeBSD: /repoman/r/ncvs/src/sys/dev/usb/usb_subr.c,v 1.94 2007/06/20 05:10:54 imp Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/usb/usb_subr.c,v 1.94 2007/06/20 05:10:54 imp Exp $");

 /*-
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
_at__at_ -1354,6 +1354,10 _at__at_
        if (dev->subdevs != NULL) {
                DPRINTFN(3,("usb_disconnect_port: disconnect  ubdevs\n"));
                for (i = 0; dev->subdevs[i]; i++) {
+                       if (device_get_nameunit(dev->subdevs[i]) == NULL) {
+                               printf("usb_disconnect_port: no subdevice, leaking\n");
+                       return;
+                       }
                        printf("%s: at %s", device_get_nameunit(dev->subdevs[i]),
                               hubname);
                        if (up->portno != 0)

With this my system survives several card insert/removals only to panic after this with ohci_rem_ed: no ED found :)

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (FreeBSD)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFGf5XHHNAJ/fLbfrkRAsgRAJ9WTqocfJzHrH+qBBV0H/d6qIyvUQCfaxT/
WE/U0hGPpSBeHcbPR7GdFTo=
=cW/3
-----END PGP SIGNATURE-----
Received on Mon Jun 25 2007 - 08:15:38 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:39:13 UTC