aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFelipe Balbi <felipe.balbi@nokia.com>2008-06-12 03:49:47 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2008-07-21 18:16:26 -0400
commit38f3ad5e7463d4dd490a8081a5f3f9f2dec7ecd6 (patch)
tree2dd60da46d065e4df9e34fe031d13e38bfc22dff
parent6deb270b5c60680ca9117bd545302ea6a58bad42 (diff)
usb: hub: add check for unsupported bus topology
We can't allow hubs on the 7th tier as they would allow devices on the 8th tier. Signed-off-by: Felipe Balbi <felipe.balbi@nokia.com> Cc: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-rw-r--r--drivers/usb/core/devices.c2
-rw-r--r--drivers/usb/core/hcd.h2
-rw-r--r--drivers/usb/core/hub.c6
3 files changed, 8 insertions, 2 deletions
diff --git a/drivers/usb/core/devices.c b/drivers/usb/core/devices.c
index a681d9b92bda..6ec38175a817 100644
--- a/drivers/usb/core/devices.c
+++ b/drivers/usb/core/devices.c
@@ -61,8 +61,6 @@
61#include "usb.h" 61#include "usb.h"
62#include "hcd.h" 62#include "hcd.h"
63 63
64#define MAX_TOPO_LEVEL 6
65
66/* Define ALLOW_SERIAL_NUMBER if you want to see the serial number of devices */ 64/* Define ALLOW_SERIAL_NUMBER if you want to see the serial number of devices */
67#define ALLOW_SERIAL_NUMBER 65#define ALLOW_SERIAL_NUMBER
68 66
diff --git a/drivers/usb/core/hcd.h b/drivers/usb/core/hcd.h
index 50b8bb2d1212..5b0b59b0d89b 100644
--- a/drivers/usb/core/hcd.h
+++ b/drivers/usb/core/hcd.h
@@ -21,6 +21,8 @@
21 21
22#include <linux/rwsem.h> 22#include <linux/rwsem.h>
23 23
24#define MAX_TOPO_LEVEL 6
25
24/* This file contains declarations of usbcore internals that are mostly 26/* This file contains declarations of usbcore internals that are mostly
25 * used or exposed by Host Controller Drivers. 27 * used or exposed by Host Controller Drivers.
26 */ 28 */
diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
index e678ed8bd8c2..3251120b414e 100644
--- a/drivers/usb/core/hub.c
+++ b/drivers/usb/core/hub.c
@@ -1051,6 +1051,12 @@ static int hub_probe(struct usb_interface *intf, const struct usb_device_id *id)
1051 desc = intf->cur_altsetting; 1051 desc = intf->cur_altsetting;
1052 hdev = interface_to_usbdev(intf); 1052 hdev = interface_to_usbdev(intf);
1053 1053
1054 if (hdev->level == MAX_TOPO_LEVEL) {
1055 dev_err(&intf->dev, "Unsupported bus topology: "
1056 "hub nested too deep\n");
1057 return -E2BIG;
1058 }
1059
1054#ifdef CONFIG_USB_OTG_BLACKLIST_HUB 1060#ifdef CONFIG_USB_OTG_BLACKLIST_HUB
1055 if (hdev->parent) { 1061 if (hdev->parent) {
1056 dev_warn(&intf->dev, "ignoring external hub\n"); 1062 dev_warn(&intf->dev, "ignoring external hub\n");