summaryrefslogtreecommitdiff
path: root/drivers/input
diff options
context:
space:
mode:
authorOliver Neukum <oneukum@suse.com>2019-08-01 19:44:25 +0300
committerDmitry Torokhov <dmitry.torokhov@gmail.com>2019-08-01 20:55:21 +0300
commitc88090dfc84254fa149174eb3e6a8458de1912c4 (patch)
treef47e16006571ba31212a8cb9c21b7a8383f7dd36 /drivers/input
parentb55d996f057bf2e7ba9422a80b5e17e99860cb0b (diff)
downloadlinux-c88090dfc84254fa149174eb3e6a8458de1912c4.tar.xz
Input: kbtab - sanity check for endpoint type
The driver should check whether the endpoint it uses has the correct type. Reported-by: syzbot+c7df50363aaff50aa363@syzkaller.appspotmail.com Signed-off-by: Oliver Neukum <oneukum@suse.com> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Diffstat (limited to 'drivers/input')
-rw-r--r--drivers/input/tablet/kbtab.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/drivers/input/tablet/kbtab.c b/drivers/input/tablet/kbtab.c
index 04b85571f41e..aa577898e952 100644
--- a/drivers/input/tablet/kbtab.c
+++ b/drivers/input/tablet/kbtab.c
@@ -117,6 +117,10 @@ static int kbtab_probe(struct usb_interface *intf, const struct usb_device_id *i
if (intf->cur_altsetting->desc.bNumEndpoints < 1)
return -ENODEV;
+ endpoint = &intf->cur_altsetting->endpoint[0].desc;
+ if (!usb_endpoint_is_int_in(endpoint))
+ return -ENODEV;
+
kbtab = kzalloc(sizeof(struct kbtab), GFP_KERNEL);
input_dev = input_allocate_device();
if (!kbtab || !input_dev)
@@ -155,8 +159,6 @@ static int kbtab_probe(struct usb_interface *intf, const struct usb_device_id *i
input_set_abs_params(input_dev, ABS_Y, 0, 0x1750, 4, 0);
input_set_abs_params(input_dev, ABS_PRESSURE, 0, 0xff, 0, 0);
- endpoint = &intf->cur_altsetting->endpoint[0].desc;
-
usb_fill_int_urb(kbtab->irq, dev,
usb_rcvintpipe(dev, endpoint->bEndpointAddress),
kbtab->data, 8,