Message ID | 20190806141538.8121-2-oneukum@suse.com (mailing list archive) |
---|---|
State | Accepted |
Commit | 849f5ae3a513c550cad741c68dd3d7eb2bcc2a2c |
Headers | show |
Series | iforce: add sanity checks | expand |
On Tue, Aug 06, 2019 at 04:15:38PM +0200, Oliver Neukum wrote: > 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> Moved the checks to where the assignments are and applied. Thank you Oliver. BTW, could you please CC me on the stuff in drivers/input/... Thanks! > --- > drivers/input/joystick/iforce/iforce-usb.c | 5 +++++ > 1 file changed, 5 insertions(+) > > diff --git a/drivers/input/joystick/iforce/iforce-usb.c b/drivers/input/joystick/iforce/iforce-usb.c > index 29abfeeef9a5..a481a226166c 100644 > --- a/drivers/input/joystick/iforce/iforce-usb.c > +++ b/drivers/input/joystick/iforce/iforce-usb.c > @@ -203,6 +203,11 @@ static int iforce_usb_probe(struct usb_interface *intf, > epirq = &interface->endpoint[0].desc; > epout = &interface->endpoint[1].desc; > > + if (!usb_endpoint_is_int_in(epirq)) > + return -ENODEV; > + if (!usb_endpoint_is_int_out(epout)) > + return -ENODEV; > + > iforce_usb = kzalloc(sizeof(*iforce_usb), GFP_KERNEL); > if (!iforce_usb) > goto fail; > -- > 2.16.4 >
diff --git a/drivers/input/joystick/iforce/iforce-usb.c b/drivers/input/joystick/iforce/iforce-usb.c index 29abfeeef9a5..a481a226166c 100644 --- a/drivers/input/joystick/iforce/iforce-usb.c +++ b/drivers/input/joystick/iforce/iforce-usb.c @@ -203,6 +203,11 @@ static int iforce_usb_probe(struct usb_interface *intf, epirq = &interface->endpoint[0].desc; epout = &interface->endpoint[1].desc; + if (!usb_endpoint_is_int_in(epirq)) + return -ENODEV; + if (!usb_endpoint_is_int_out(epout)) + return -ENODEV; + iforce_usb = kzalloc(sizeof(*iforce_usb), GFP_KERNEL); if (!iforce_usb) goto fail;
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> --- drivers/input/joystick/iforce/iforce-usb.c | 5 +++++ 1 file changed, 5 insertions(+)