diff options
Diffstat (limited to 'kernel/drivers/input/tablet/gtco.c')
-rw-r--r-- | kernel/drivers/input/tablet/gtco.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/kernel/drivers/input/tablet/gtco.c b/kernel/drivers/input/tablet/gtco.c index 3a7f3a4a4..7c18249d6 100644 --- a/kernel/drivers/input/tablet/gtco.c +++ b/kernel/drivers/input/tablet/gtco.c @@ -858,6 +858,14 @@ static int gtco_probe(struct usb_interface *usbinterface, goto err_free_buf; } + /* Sanity check that a device has an endpoint */ + if (usbinterface->altsetting[0].desc.bNumEndpoints < 1) { + dev_err(&usbinterface->dev, + "Invalid number of endpoints\n"); + error = -EINVAL; + goto err_free_urb; + } + /* * The endpoint is always altsetting 0, we know this since we know * this device only has one interrupt endpoint @@ -879,7 +887,7 @@ static int gtco_probe(struct usb_interface *usbinterface, * HID report descriptor */ if (usb_get_extra_descriptor(usbinterface->cur_altsetting, - HID_DEVICE_TYPE, &hid_desc) != 0){ + HID_DEVICE_TYPE, &hid_desc) != 0) { dev_err(&usbinterface->dev, "Can't retrieve exta USB descriptor to get hid report descriptor length\n"); error = -EIO; |