Skip to content

Commit 5cc4a1a

Browse files
jhovolddtor
authored andcommitted
Input: yealink - 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: aca951a ("[PATCH] input-driver-yealink-P1K-usb-phone") Signed-off-by: Johan Hovold <[email protected]> Cc: [email protected] # 2.6.14 Signed-off-by: Dmitry Torokhov <[email protected]>
1 parent 1916d31 commit 5cc4a1a

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

drivers/input/misc/yealink.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -875,6 +875,10 @@ static int usb_probe(struct usb_interface *intf, const struct usb_device_id *id)
875875
int ret, pipe, i;
876876

877877
interface = intf->cur_altsetting;
878+
879+
if (interface->desc.bNumEndpoints < 1)
880+
return -ENODEV;
881+
878882
endpoint = &interface->endpoint[0].desc;
879883
if (!usb_endpoint_is_int_in(endpoint))
880884
return -ENODEV;

0 commit comments

Comments
 (0)