Skip to content

Commit c88090d

Browse files
oneukumdtor
authored andcommitted
Input: kbtab - sanity check for endpoint type
The driver should check whether the endpoint it uses has the correct type. Reported-by: [email protected] Signed-off-by: Oliver Neukum <[email protected]> Signed-off-by: Dmitry Torokhov <[email protected]>
1 parent b55d996 commit c88090d

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

drivers/input/tablet/kbtab.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,10 @@ static int kbtab_probe(struct usb_interface *intf, const struct usb_device_id *i
117117
if (intf->cur_altsetting->desc.bNumEndpoints < 1)
118118
return -ENODEV;
119119

120+
endpoint = &intf->cur_altsetting->endpoint[0].desc;
121+
if (!usb_endpoint_is_int_in(endpoint))
122+
return -ENODEV;
123+
120124
kbtab = kzalloc(sizeof(struct kbtab), GFP_KERNEL);
121125
input_dev = input_allocate_device();
122126
if (!kbtab || !input_dev)
@@ -155,8 +159,6 @@ static int kbtab_probe(struct usb_interface *intf, const struct usb_device_id *i
155159
input_set_abs_params(input_dev, ABS_Y, 0, 0x1750, 4, 0);
156160
input_set_abs_params(input_dev, ABS_PRESSURE, 0, 0xff, 0, 0);
157161

158-
endpoint = &intf->cur_altsetting->endpoint[0].desc;
159-
160162
usb_fill_int_urb(kbtab->irq, dev,
161163
usb_rcvintpipe(dev, endpoint->bEndpointAddress),
162164
kbtab->data, 8,

0 commit comments

Comments
 (0)