mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-10 04:48:04 +09:00
USB: iowarrior: fix NULL-deref at probe
am: 179295c38d
Change-Id: If8771741f6228ec6af891a160d5af5f6789f5409
This commit is contained in:
@@ -787,12 +787,6 @@ static int iowarrior_probe(struct usb_interface *interface,
|
||||
iface_desc = interface->cur_altsetting;
|
||||
dev->product_id = le16_to_cpu(udev->descriptor.idProduct);
|
||||
|
||||
if (iface_desc->desc.bNumEndpoints < 1) {
|
||||
dev_err(&interface->dev, "Invalid number of endpoints\n");
|
||||
retval = -EINVAL;
|
||||
goto error;
|
||||
}
|
||||
|
||||
/* set up the endpoint information */
|
||||
for (i = 0; i < iface_desc->desc.bNumEndpoints; ++i) {
|
||||
endpoint = &iface_desc->endpoint[i].desc;
|
||||
@@ -803,6 +797,13 @@ static int iowarrior_probe(struct usb_interface *interface,
|
||||
/* this one will match for the IOWarrior56 only */
|
||||
dev->int_out_endpoint = endpoint;
|
||||
}
|
||||
|
||||
if (!dev->int_in_endpoint) {
|
||||
dev_err(&interface->dev, "no interrupt-in endpoint found\n");
|
||||
retval = -ENODEV;
|
||||
goto error;
|
||||
}
|
||||
|
||||
/* we have to check the report_size often, so remember it in the endianness suitable for our machine */
|
||||
dev->report_size = usb_endpoint_maxp(dev->int_in_endpoint);
|
||||
if ((dev->interface->cur_altsetting->desc.bInterfaceNumber == 0) &&
|
||||
|
||||
Reference in New Issue
Block a user