Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 38f3ad5e authored by Felipe Balbi's avatar Felipe Balbi Committed by Greg Kroah-Hartman
Browse files

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: default avatarFelipe Balbi <felipe.balbi@nokia.com>
Cc: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 6deb270b
Loading
Loading
Loading
Loading
+0 −2
Original line number Diff line number Diff line
@@ -61,8 +61,6 @@
#include "usb.h"
#include "hcd.h"

#define MAX_TOPO_LEVEL		6

/* Define ALLOW_SERIAL_NUMBER if you want to see the serial number of devices */
#define ALLOW_SERIAL_NUMBER

+2 −0
Original line number Diff line number Diff line
@@ -21,6 +21,8 @@

#include <linux/rwsem.h>

#define MAX_TOPO_LEVEL		6

/* This file contains declarations of usbcore internals that are mostly
 * used or exposed by Host Controller Drivers.
 */
+6 −0
Original line number Diff line number Diff line
@@ -1051,6 +1051,12 @@ static int hub_probe(struct usb_interface *intf, const struct usb_device_id *id)
	desc = intf->cur_altsetting;
	hdev = interface_to_usbdev(intf);

	if (hdev->level == MAX_TOPO_LEVEL) {
		dev_err(&intf->dev, "Unsupported bus topology: "
				"hub nested too deep\n");
		return -E2BIG;
	}

#ifdef	CONFIG_USB_OTG_BLACKLIST_HUB
	if (hdev->parent) {
		dev_warn(&intf->dev, "ignoring external hub\n");