Skip to content

Commit

Permalink
Input: xpad - validate USB endpoint count during probe
Browse files Browse the repository at this point in the history
This prevents a malicious USB device from causing an oops.

Signed-off-by: Cameron Gutman <aicommander@gmail.com>
Cc: stable@vger.kernel.org
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
  • Loading branch information
Cameron Gutman authored and Dmitry Torokhov committed Jun 29, 2016
1 parent 9a9b6aa commit caca925
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions drivers/input/joystick/xpad.c
Original file line number Diff line number Diff line change
Expand Up @@ -1431,6 +1431,9 @@ static int xpad_probe(struct usb_interface *intf, const struct usb_device_id *id
int ep_irq_in_idx;
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))
Expand Down

0 comments on commit caca925

Please sign in to comment.