summaryrefslogtreecommitdiff
path: root/drivers/input/joystick
diff options
context:
space:
mode:
authorOliver Neukum <oneukum@suse.com>2019-08-06 19:05:55 +0300
committerDmitry Torokhov <dmitry.torokhov@gmail.com>2019-08-06 19:10:57 +0300
commit849f5ae3a513c550cad741c68dd3d7eb2bcc2a2c (patch)
tree20c803402338fbae3ffc329294e94f210e8404cf /drivers/input/joystick
parent37ad2e343449ced9e41505eae5494bf40f433181 (diff)
downloadlinux-849f5ae3a513c550cad741c68dd3d7eb2bcc2a2c.tar.xz
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>
Diffstat (limited to 'drivers/input/joystick')
-rw-r--r--drivers/input/joystick/iforce/iforce-usb.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/input/joystick/iforce/iforce-usb.c b/drivers/input/joystick/iforce/iforce-usb.c
index 29abfeeef9a5..6c554c11a7ac 100644
--- a/drivers/input/joystick/iforce/iforce-usb.c
+++ b/drivers/input/joystick/iforce/iforce-usb.c
@@ -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)