Greg:

One of the few points from the recent discussion that all participants
agreed on was that we should not allow probing or config changes to be
attempted on suspended devices.  This patch implements that policy, and it
also prevents attempts to change altsettings.  That's just for
consistency's sake; even without the patch an attempted altsetting change
on a suspended device would simply fail without doing any harm.  By
contrast, a configuration change would unbind all the existing drivers
before encountering an error, something we don't want to happen.

Please apply.

Alan Stern



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

===== drivers/usb/core/message.c 1.96 vs edited =====
--- 1.96/drivers/usb/core/message.c     Wed Jun 30 13:36:17 2004
+++ edited/drivers/usb/core/message.c   Wed Jun 30 13:48:12 2004
@@ -1034,6 +1034,9 @@
        int ret;
        int manual = 0;
 
+       if (dev->state == USB_STATE_SUSPENDED)
+               return -EHOSTUNREACH;
+
        iface = usb_ifnum_to_if(dev, interface);
        if (!iface) {
                dev_dbg(&dev->dev, "selecting invalid interface %d\n",
@@ -1133,6 +1136,9 @@
        int                     i, retval;
        struct usb_host_config  *config;
 
+       if (dev->state == USB_STATE_SUSPENDED)
+               return -EHOSTUNREACH;
+
        /* caller must have locked the device and must own
         * the usb bus readlock (so driver bindings are stable);
         * so calls during probe() are fine
@@ -1242,6 +1248,9 @@
         */
        if (cp && configuration == 0)
                dev_warn(&dev->dev, "config 0 descriptor??\n");
+
+       if (dev->state == USB_STATE_SUSPENDED)
+               return -EHOSTUNREACH;
 
        /* Allocate memory for new interfaces before doing anything else,
         * so that if we run out then nothing will have changed. */
===== drivers/usb/core/usb.c 1.279 vs edited =====
--- 1.279/drivers/usb/core/usb.c        Thu Jun 24 14:06:12 2004
+++ edited/drivers/usb/core/usb.c       Wed Jun 30 13:44:26 2004
@@ -96,6 +96,8 @@
 
        if (!driver->probe)
                return error;
+       if (interface_to_usbdev(intf)->state == USB_STATE_SUSPENDED)
+               return -EHOSTUNREACH;
 
        id = usb_match_id (intf, driver->id_table);
        if (id) {



-------------------------------------------------------
This SF.Net email sponsored by Black Hat Briefings & Training.
Attend Black Hat Briefings & Training, Las Vegas July 24-29 - 
digital self defense, top technical experts, no vendor pitches, 
unmatched networking opportunities. Visit www.blackhat.com
_______________________________________________
[EMAIL PROTECTED]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to