Unverified Commit dadc9a82 authored by openeuler-ci-bot's avatar openeuler-ci-bot Committed by Gitee
Browse files

!15345 USB: hub: Ignore non-compliant devices with too many configs or interfaces

parents 676ce157 04fb5746
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -1818,6 +1818,17 @@ static int hub_probe(struct usb_interface *intf, const struct usb_device_id *id)
	desc = intf->cur_altsetting;
	hdev = interface_to_usbdev(intf);

	/*
	 * The USB 2.0 spec prohibits hubs from having more than one
	 * configuration or interface, and we rely on this prohibition.
	 * Refuse to accept a device that violates it.
	 */
	if (hdev->descriptor.bNumConfigurations > 1 ||
			hdev->actconfig->desc.bNumInterfaces > 1) {
		dev_err(&intf->dev, "Invalid hub with more than one config or interface\n");
		return -EINVAL;
	}

	/*
	 * Set default autosuspend delay as 0 to speedup bus suspend,
	 * based on the below considerations: