Am Donnerstag, 25. September 2003 18:02 schrieb David Brownell:
> Alan Stern wrote:
> 
> > 
> > I'm with Oliver on this one.  What if a usb_reset_configuration() call was 
> > going on at the same time?  The code here would set the state to 
> > NOTATTACHED and then reset_config would set it to ADDRESS.  Not what we 
> > want.
> 
> So submit a patch to make reset_configuration() verify that the
> device is present before that.  That scenario is rather unlikely;
> but it's of course worth handling correctly.

Yes, exactly, but to do that you need to make sure that the state remains
constant between test and changing the state. To do so, you need a lock.
More specifically you race with code like this:

+       if (retval < 0) {
+               dev->state = USB_STATE_ADDRESS;
+               goto done;
+       }

or this:

+               dev->actconfig = 0;
+               if (dev->state == USB_STATE_CONFIGURED)
+                       dev->state = USB_STATE_ADDRESS;

        Regards
                Oliver



-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
[EMAIL PROTECTED]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to