Skip to content

Commit 122d6a3

Browse files
cgutmandtor
authored andcommitted
Input: xpad - validate USB endpoint type during probe
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 <[email protected]> Tested-by: Andrey Konovalov <[email protected]> Cc: <[email protected]> # c01b5e7 Input: xpad - don't depend on endpoint order Signed-off-by: Cameron Gutman <[email protected]> Signed-off-by: Dmitry Torokhov <[email protected]>
1 parent 39467fc commit 122d6a3

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

drivers/input/joystick/xpad.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1750,10 +1750,12 @@ static int xpad_probe(struct usb_interface *intf, const struct usb_device_id *id
17501750
struct usb_endpoint_descriptor *ep =
17511751
&intf->cur_altsetting->endpoint[i].desc;
17521752

1753-
if (usb_endpoint_dir_in(ep))
1754-
ep_irq_in = ep;
1755-
else
1756-
ep_irq_out = ep;
1753+
if (usb_endpoint_xfer_int(ep)) {
1754+
if (usb_endpoint_dir_in(ep))
1755+
ep_irq_in = ep;
1756+
else
1757+
ep_irq_out = ep;
1758+
}
17571759
}
17581760

17591761
if (!ep_irq_in || !ep_irq_out) {

0 commit comments

Comments
 (0)