ChangeSet 1.1807.48.39, 2004/08/05 14:59:08-07:00, [EMAIL PROTECTED]

[PATCH] USB: Disallow probing etc. for suspended devices

This patch is a repeat of as335, as described in

http://marc.theaimsgroup.com/?l=linux-usb-devel&m=108861892700869&w=2

but updated to match the current source.  It should be non-controversial;
it has nothing to do with hubs or locking.  Please apply.

Alan Stern



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


 drivers/usb/core/message.c |    9 +++++++++
 drivers/usb/core/usb.c     |    2 ++
 2 files changed, 11 insertions(+)


diff -Nru a/drivers/usb/core/message.c b/drivers/usb/core/message.c
--- a/drivers/usb/core/message.c        2004-08-23 13:18:36 -07:00
+++ b/drivers/usb/core/message.c        2004-08-23 13:18:36 -07:00
@@ -1044,6 +1044,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",
@@ -1141,6 +1144,9 @@
        int                     i, retval;
        struct usb_host_config  *config;
 
+       if (dev->state == USB_STATE_SUSPENDED)
+               return -EHOSTUNREACH;
+
        /* caller must own dev->serialize (config won't change)
         * and the usb bus readlock (so driver bindings are stable);
         * so calls during probe() are fine
@@ -1252,6 +1258,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. */
diff -Nru a/drivers/usb/core/usb.c b/drivers/usb/core/usb.c
--- a/drivers/usb/core/usb.c    2004-08-23 13:18:36 -07:00
+++ b/drivers/usb/core/usb.c    2004-08-23 13:18:36 -07:00
@@ -93,6 +93,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) {



-------------------------------------------------------
SF.Net email is sponsored by Shop4tech.com-Lowest price on Blank Media
100pk Sonic DVD-R 4x for only $29 -100pk Sonic DVD+R for only $33
Save 50% off Retail on Ink & Toner - Free Shipping and Free Gift.
http://www.shop4tech.com/z/Inkjet_Cartridges/9_108_r285
_______________________________________________
[EMAIL PROTECTED]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to