diff options
author | Cameron Gutman <aicommander@gmail.com> | 2016-06-29 09:51:35 -0700 |
---|---|---|
committer | Ben Hutchings <ben@decadent.org.uk> | 2016-11-20 01:16:43 +0000 |
commit | df03e1a1d939f5a8d1aaa2e414cc6a070f70fc19 (patch) | |
tree | 2bbff6c0591f20afbe191505143dada4be685550 /drivers/input | |
parent | a633aa19814dea6c280b485fc8c0826537e034ee (diff) | |
download | linux-stable-df03e1a1d939f5a8d1aaa2e414cc6a070f70fc19.tar.gz linux-stable-df03e1a1d939f5a8d1aaa2e414cc6a070f70fc19.tar.bz2 linux-stable-df03e1a1d939f5a8d1aaa2e414cc6a070f70fc19.zip |
Input: xpad - validate USB endpoint count during probe
commit caca925fca4fb30c67be88cacbe908eec6721e43 upstream.
This prevents a malicious USB device from causing an oops.
Signed-off-by: Cameron Gutman <aicommander@gmail.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Diffstat (limited to 'drivers/input')
-rw-r--r-- | drivers/input/joystick/xpad.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/input/joystick/xpad.c b/drivers/input/joystick/xpad.c index e2c655964711..a137a3738128 100644 --- a/drivers/input/joystick/xpad.c +++ b/drivers/input/joystick/xpad.c @@ -883,6 +883,9 @@ static int xpad_probe(struct usb_interface *intf, const struct usb_device_id *id struct usb_endpoint_descriptor *ep_irq_in; int i, error; + if (intf->cur_altsetting->desc.bNumEndpoints != 2) + return -ENODEV; + for (i = 0; xpad_device[i].idVendor; i++) { if ((le16_to_cpu(udev->descriptor.idVendor) == xpad_device[i].idVendor) && (le16_to_cpu(udev->descriptor.idProduct) == xpad_device[i].idProduct)) |