[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <cbd99aa67e07ea187b507fff17f517359df7afba.1491838390.git.jslaby@suse.cz>
Date: Mon, 10 Apr 2017 17:32:35 +0200
From: Jiri Slaby <jslaby@...e.cz>
To: stable@...r.kernel.org
Cc: linux-kernel@...r.kernel.org, Johan Hovold <johan@...nel.org>,
Dmitry Torokhov <dmitry.torokhov@...il.com>,
Jiri Slaby <jslaby@...e.cz>
Subject: [PATCH 3.12 074/142] Input: iforce - validate number of endpoints before using them
From: Johan Hovold <johan@...nel.org>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit 59cf8bed44a79ec42303151dd014fdb6434254bb upstream.
Make sure to check the number of endpoints to avoid dereferencing a
NULL-pointer or accessing memory that lie beyond the end of the endpoint
array should a malicious device lack the expected endpoints.
Signed-off-by: Johan Hovold <johan@...nel.org>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@...il.com>
Signed-off-by: Jiri Slaby <jslaby@...e.cz>
---
drivers/input/joystick/iforce/iforce-usb.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/input/joystick/iforce/iforce-usb.c b/drivers/input/joystick/iforce/iforce-usb.c
index d96aa27dfcdc..db64adfbe1af 100644
--- a/drivers/input/joystick/iforce/iforce-usb.c
+++ b/drivers/input/joystick/iforce/iforce-usb.c
@@ -141,6 +141,9 @@ static int iforce_usb_probe(struct usb_interface *intf,
interface = intf->cur_altsetting;
+ if (interface->desc.bNumEndpoints < 2)
+ return -ENODEV;
+
epirq = &interface->endpoint[0].desc;
epout = &interface->endpoint[1].desc;
--
2.12.2
Powered by blists - more mailing lists