Re: PATCH: (as279) Don't delete interfaces until all are unbound

From: Alan Stern
Date: Thu May 13 2004 - 16:04:42 EST

On Thu, 13 May 2004, Duncan Sands wrote:

> Hi Alan,
> > + /* Now that the interfaces are unbound, nobody should
> > + * try to access them.
> > + */
> how is usbfs going to claim interfaces after this?

After this there _are_ no interfaces! They've all been destroyed by
usb_disable_device(), called as part of usb_set_configuration() or
usb_disconnect(). Of course, usb_set_configuration() will go ahead and
create a new set of interfaces that usbfs can then bind.

> > + * Don't call this function unless you are bound to one of the interfaces
> > + * on this device or you own the dev->serialize semaphore!
> Owning dev->serialize won't stop an Oops if the interfaces are all NULL...

If you own dev->serialize then usb_disable_device() can't be running
concurrently, since it requires its caller to own that semaphore (although
that may not be stated explicitly). Hence either the interfaces won't be
NULL or else dev->actconfig will be NULL, and in either case
usb_ifnum_to_if() will work okay.

Alan Stern

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at
Please read the FAQ at