aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/core/message.c
diff options
context:
space:
mode:
authorInaky Perez-Gonzalez <inaky@linux.intel.com>2007-07-31 23:34:01 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2007-10-12 17:55:06 -0400
commit16bbab2966309ae82cda3d378964c56096d4858c (patch)
tree3ff9aee7f4d4752bc5c0392e19845eae00a1ab77 /drivers/usb/core/message.c
parentd7d07255d3f5607802b0af29e11448d18e9ed558 (diff)
usb: usb_set_configuration() obeys authorization
Will refuse to configure a non-authorized device. Update: simplified if statement--thanks to Ragner Magalhaes for the heads up. Signed-off-by: Inaky Perez-Gonzalez <inaky@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb/core/message.c')
-rw-r--r--drivers/usb/core/message.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/usb/core/message.c b/drivers/usb/core/message.c
index a26a7292b61..025ac0bd353 100644
--- a/drivers/usb/core/message.c
+++ b/drivers/usb/core/message.c
@@ -1483,6 +1483,9 @@ static struct usb_interface_assoc_descriptor *find_iad(struct usb_device *dev,
1483 * channels are available independently; and choosing between open 1483 * channels are available independently; and choosing between open
1484 * standard device protocols (like CDC) or proprietary ones. 1484 * standard device protocols (like CDC) or proprietary ones.
1485 * 1485 *
1486 * Note that a non-authorized device (dev->authorized == 0) will only
1487 * be put in unconfigured mode.
1488 *
1486 * Note that USB has an additional level of device configurability, 1489 * Note that USB has an additional level of device configurability,
1487 * associated with interfaces. That configurability is accessed using 1490 * associated with interfaces. That configurability is accessed using
1488 * usb_set_interface(). 1491 * usb_set_interface().
@@ -1504,7 +1507,7 @@ int usb_set_configuration(struct usb_device *dev, int configuration)
1504 struct usb_interface **new_interfaces = NULL; 1507 struct usb_interface **new_interfaces = NULL;
1505 int n, nintf; 1508 int n, nintf;
1506 1509
1507 if (configuration == -1) 1510 if (dev->authorized == 0 || configuration == -1)
1508 configuration = 0; 1511 configuration = 0;
1509 else { 1512 else {
1510 for (i = 0; i < dev->descriptor.bNumConfigurations; i++) { 1513 for (i = 0; i < dev->descriptor.bNumConfigurations; i++) {