Skip to content

Commit cb1b494

Browse files
jhovolddtor
authored andcommitted
Input: kbtab - validate number of endpoints before using them
Make sure to check the number of endpoints to avoid dereferencing a NULL-pointer should a malicious device lack endpoints. Signed-off-by: Johan Hovold <[email protected]> Cc: [email protected] Signed-off-by: Dmitry Torokhov <[email protected]>
1 parent ba340d7 commit cb1b494

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

drivers/input/tablet/kbtab.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,9 @@ static int kbtab_probe(struct usb_interface *intf, const struct usb_device_id *i
122122
struct input_dev *input_dev;
123123
int error = -ENOMEM;
124124

125+
if (intf->cur_altsetting->desc.bNumEndpoints < 1)
126+
return -ENODEV;
127+
125128
kbtab = kzalloc(sizeof(struct kbtab), GFP_KERNEL);
126129
input_dev = input_allocate_device();
127130
if (!kbtab || !input_dev)

0 commit comments

Comments
 (0)