Skip to content

Commit

Permalink
Input: iforce - validate number of endpoints before using them
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Johan Hovold authored and Dmitry Torokhov committed Mar 16, 2017
1 parent 92ef6f9 commit 59cf8be
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions drivers/input/joystick/iforce/iforce-usb.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down

0 comments on commit 59cf8be

Please sign in to comment.