Skip to content

Commit ba340d7

Browse files
jhovolddtor
authored andcommitted
Input: hanwang - 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. Fixes: bba5394 ("Input: add support for Hanwang tablets") Signed-off-by: Johan Hovold <[email protected]> Cc: [email protected] # 2.6.37 Signed-off-by: Dmitry Torokhov <[email protected]>
1 parent 5cc4a1a commit ba340d7

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

drivers/input/tablet/hanwang.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -340,6 +340,9 @@ static int hanwang_probe(struct usb_interface *intf, const struct usb_device_id
340340
int error;
341341
int i;
342342

343+
if (intf->cur_altsetting->desc.bNumEndpoints < 1)
344+
return -ENODEV;
345+
343346
hanwang = kzalloc(sizeof(struct hanwang), GFP_KERNEL);
344347
input_dev = input_allocate_device();
345348
if (!hanwang || !input_dev) {

0 commit comments

Comments
 (0)