diff options
author | Johan Hovold <johan@kernel.org> | 2017-03-16 11:34:02 -0700 |
---|---|---|
committer | Sasha Levin <alexander.levin@verizon.com> | 2017-05-17 15:07:02 -0400 |
commit | 76d981017361e0937f2f2c83fe7b02b590e74bdd (patch) | |
tree | a2ca77de6539bc966064987236ede856ab0c610e /drivers/input | |
parent | edf3bd9562a949ea5799e79e49ca75cb52b10892 (diff) |
Input: iforce - validate number of endpoints before using them
[ Upstream commit 59cf8bed44a79ec42303151dd014fdb6434254bb ]
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@kernel.org>
Cc: stable@vger.kernel.org
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
Diffstat (limited to 'drivers/input')
-rw-r--r-- | drivers/input/joystick/iforce/iforce-usb.c | 3 |
1 files changed, 3 insertions, 0 deletions
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; |