On Mon, 25 Apr 2005, Roman Kagan wrote:

> > > Still trying to get in touch with Pat Mochel on that and especially on
> > > the more convoluted klist case,
> > 
> > I've spent a fair amount of time going over the klist code too, and while 
> > there may still be a problem or two this doesn't appear to be one of them.  
> 
> Are you talking of some private tree?  The comments I've posted re.
> this problem in the klist case were against 2.6.12-rc2-mm3, and I
> haven't seen anything more recent which would fix it.
> 
> In case you've missed that message, it's archived here:
> 
> http://marc.theaimsgroup.com/?l=linux-usb-devel&m=111341625900343

I see.  This may not be a problem so much with klists as with usbcore.  
That is, device_release_driver isn't protected against recursion, but
perhaps it doesn't need to be since usbcore can be changed to prevent
recursion in usb_driver_release_interface.  A patch for 2.6.12-rc3 is
below; the same approach should work with -mm.  Let me know what you
think.

The other problem I was thinking of is related to the one you found.  
Since driver_detach doesn't immediately delete the device from its 
driver's list, it's possible that another driver will bind to the device 
first and thereby corrupt the list pointers.  I haven't heard anything 
from Pat since bringing this to his attention.

Alan Stern



Signed-off-by: Alan Stern <[EMAIL PROTECTED]>

Index: usb-2.6/drivers/usb/core/usb.c
===================================================================
--- usb-2.6.orig/drivers/usb/core/usb.c
+++ usb-2.6/drivers/usb/core/usb.c
@@ -323,8 +323,11 @@ void usb_driver_release_interface(struct
                return;
 
        /* don't disconnect from disconnect(), or before dev_add() */
-       if (!list_empty (&dev->driver_list) && !list_empty (&dev->bus_list))
+       if (iface->condition == USB_INTERFACE_BOUND &&
+                       !list_empty (&dev->bus_list)) {
+               iface->condition = USB_INTERFACE_UNBINDING;
                device_release_driver(dev);
+       }
 
        dev->driver = NULL;
        usb_set_intfdata(iface, NULL);



-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to