This patch is to add a check of "portnum" which from the usb port dev's name. The "portnum" will be used as array index for struct usb_hub->ports in the usb_set_hub_port_connect_type(). Signed-off-by: Lan Tianyu <tianyu.lan@xxxxxxxxx> --- drivers/usb/core/usb-acpi.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/usb/core/usb-acpi.c b/drivers/usb/core/usb-acpi.c index 255c144..ec0e7cf 100644 --- a/drivers/usb/core/usb-acpi.c +++ b/drivers/usb/core/usb-acpi.c @@ -183,6 +183,9 @@ static int usb_acpi_find_device(struct device *dev, acpi_handle *handle) /* Get the struct usb_device point of port's hub */ udev = to_usb_device(dev->parent->parent); + if (port_num == 0 || port_num > udev->maxchild) + return -EINVAL; + /* * The root hub ports' parent is the root hub. The non-root-hub * ports' parent is the parent hub port which the hub is -- 1.7.10.4 -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html