Commit 0f9857a0 authored by Alan Stern's avatar Alan Stern Committed by Greg Kroah-Hartman

[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: default avatarAlan Stern <stern@rowland.harvard.edu>
Signed-off-by: default avatarGreg Kroah-Hartman <greg@kroah.com>
parent f513e021
......@@ -1044,6 +1044,9 @@ int usb_set_interface(struct usb_device *dev, int interface, int alternate)
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 usb_reset_configuration(struct usb_device *dev)
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
......@@ -1253,6 +1259,9 @@ int usb_set_configuration(struct usb_device *dev, int configuration)
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. */
n = nintf = 0;
......
......@@ -93,6 +93,8 @@ int usb_probe_interface(struct device *dev)
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) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment