From: Johan Hovold <johan@kernel.org>
To: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Cc: linux-input@vger.kernel.org, linux-usb@vger.kernel.org,
linux-kernel@vger.kernel.org, Johan Hovold <johan@kernel.org>,
stable <stable@vger.kernel.org>
Subject: [PATCH 1/7] Input: iforce - fix NULL-deref at probe
Date: Mon, 13 Mar 2017 13:35:33 +0100 [thread overview]
Message-ID: <20170313123539.28103-2-johan@kernel.org> (raw)
In-Reply-To: <20170313123539.28103-1-johan@kernel.org>
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.
Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Johan Hovold <johan@kernel.org>
---
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.0
next prev parent reply other threads:[~2017-03-13 12:38 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-03-13 12:35 [PATCH 0/7] Input: fix NULL-derefs at probe Johan Hovold
2017-03-13 12:35 ` Johan Hovold [this message]
2017-03-13 12:35 ` [PATCH 2/7] Input: cm109 - fix NULL-deref " Johan Hovold
2017-03-13 12:35 ` [PATCH 3/7] Input: ims-pcu " Johan Hovold
2017-03-13 12:35 ` [PATCH 4/7] Input: yealink " Johan Hovold
2017-03-13 12:35 ` [PATCH 5/7] Input: hanwang " Johan Hovold
2017-03-13 12:35 ` [PATCH 6/7] Input: kbtab " Johan Hovold
2017-03-13 12:35 ` [PATCH 7/7] Input: sur40 " Johan Hovold
2017-03-13 15:15 ` [PATCH 0/7] Input: fix NULL-derefs " Oliver Neukum
2017-03-13 15:45 ` Johan Hovold
2017-03-16 22:37 ` Dmitry Torokhov
2017-03-17 10:53 ` Johan Hovold
2017-03-17 21:03 ` Dmitry Torokhov
2017-03-18 9:13 ` Johan Hovold
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170313123539.28103-2-johan@kernel.org \
--to=johan@kernel.org \
--cc=dmitry.torokhov@gmail.com \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=stable@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).