usb/80829: possible panic when loading USB-modules

Warner Losh imp at bsdimp.com
Mon May 9 13:47:12 PDT 2005


> I'm planning to use the stack method and have usbd_probe_and_attach() called 
> again from uhub_explore() via a call similar to usb_explore(). Leaving 
> devices after usbd_probe_and_attach() has returned, will _not_ work, except 
> for generic or specific USB drivers. It will not work for "ums", "ukbd" and 
> so on, because a device can have more than one configuration, and it is not 
> sure that the right configuration index is set when usbd_probe_and_attach() 
> returns after the generic probe. Have a look at this (almost finished):
> 
> Implement a new state-variable "udev->probed" and a refcount in "usbd_port" to 
> limit the calling of "usbd_probe_and_attach()".
> 
> Any comments?

That can't work.  The problem is that if there's no driver loaded, the
device_t sticks around (and must stick around).  When the driver is
then loaded, we look at all the unattached devices again and at that
point the memory that's reference has to be stable.  That's why I made
the change in the first place.

Warner


More information about the freebsd-usb mailing list