From: Cameron Gutman Date: Tue, 12 Sep 2017 18:27:44 +0000 (-0700) Subject: Input: xpad - validate USB endpoint type during probe X-Git-Tag: v3.2.96~15 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d5025b4788cafc54fb0160d9d8a6ff0fd42416f5;p=thirdparty%2Fkernel%2Fstable.git Input: xpad - validate USB endpoint type during probe commit 122d6a347329818419b032c5a1776e6b3866d9b9 upstream. We should only see devices with interrupt endpoints. Ignore any other endpoints that we find, so we don't send try to send them interrupt URBs and trigger a WARN down in the USB stack. Reported-by: Andrey Konovalov Tested-by: Andrey Konovalov Signed-off-by: Cameron Gutman Signed-off-by: Dmitry Torokhov Signed-off-by: Ben Hutchings --- diff --git a/drivers/input/joystick/xpad.c b/drivers/input/joystick/xpad.c index bf0be6da3abea..a092c45b999e8 100644 --- a/drivers/input/joystick/xpad.c +++ b/drivers/input/joystick/xpad.c @@ -1073,10 +1073,12 @@ static int xpad_probe(struct usb_interface *intf, const struct usb_device_id *id struct usb_endpoint_descriptor *ep = &intf->cur_altsetting->endpoint[i].desc; - if (usb_endpoint_dir_in(ep)) - ep_irq_in = ep; - else - ep_irq_out = ep; + if (usb_endpoint_xfer_int(ep)) { + if (usb_endpoint_dir_in(ep)) + ep_irq_in = ep; + else + ep_irq_out = ep; + } } if (!ep_irq_in || !ep_irq_out) {