Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a07b3477 authored by Cameron Gutman's avatar Cameron Gutman
Browse files

BACKPORT: Input: xpad - validate USB endpoint count during probe



This prevents a malicious USB device from causing an oops.

Change-Id: I47c27541a4c2f0cec354eb83b3013bb825ed6e90
Signed-off-by: default avatarCameron Gutman <aicommander@gmail.com>
Cc: stable@vger.kernel.org
Signed-off-by: default avatarDmitry Torokhov <dmitry.torokhov@gmail.com>
parent d240a0a1
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -1200,6 +1200,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))