Skip to content

Commit 1916d31

Browse files
jhovolddtor
authored andcommitted
Input: ims-pcu - 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 control-interface endpoints. Fixes: 628329d ("Input: add IMS Passenger Control Unit driver") Signed-off-by: Johan Hovold <[email protected]> Cc: [email protected] # 3.10 Signed-off-by: Dmitry Torokhov <[email protected]>
1 parent ac2ee9b commit 1916d31

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

drivers/input/misc/ims-pcu.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1667,6 +1667,10 @@ static int ims_pcu_parse_cdc_data(struct usb_interface *intf, struct ims_pcu *pc
16671667
return -EINVAL;
16681668

16691669
alt = pcu->ctrl_intf->cur_altsetting;
1670+
1671+
if (alt->desc.bNumEndpoints < 1)
1672+
return -ENODEV;
1673+
16701674
pcu->ep_ctrl = &alt->endpoint[0].desc;
16711675
pcu->max_ctrl_size = usb_endpoint_maxp(pcu->ep_ctrl);
16721676

0 commit comments

Comments
 (0)