Input: iforce - add sanity checks

The endpoint type should also be checked before a device
is accepted.

Reported-by: syzbot+5efc10c005014d061a74@syzkaller.appspotmail.com
Signed-off-by: Oliver Neukum <oneukum@suse.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
This commit is contained in:
Oliver Neukum 2019-08-06 09:05:55 -07:00 committed by Dmitry Torokhov
parent 37ad2e3434
commit 849f5ae3a5

View File

@ -201,7 +201,12 @@ static int iforce_usb_probe(struct usb_interface *intf,
return -ENODEV;
epirq = &interface->endpoint[0].desc;
if (!usb_endpoint_is_int_in(epirq))
return -ENODEV;
epout = &interface->endpoint[1].desc;
if (!usb_endpoint_is_int_out(epout))
return -ENODEV;
iforce_usb = kzalloc(sizeof(*iforce_usb), GFP_KERNEL);
if (!iforce_usb)