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>, Henk <Henk.Vergonet@gmail.com>
Subject: [PATCH 4/7] Input: yealink - fix NULL-deref at probe
Date: Mon, 13 Mar 2017 13:35:36 +0100 [thread overview]
Message-ID: <20170313123539.28103-5-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 should a malicious device lack endpoints.
Fixes: aca951a22a1d ("[PATCH] input-driver-yealink-P1K-usb-phone")
Cc: stable <stable@vger.kernel.org> # 2.6.14
Cc: Henk <Henk.Vergonet@gmail.com>
Signed-off-by: Johan Hovold <johan@kernel.org>
---
drivers/input/misc/yealink.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/input/misc/yealink.c b/drivers/input/misc/yealink.c
index 79c964c075f1..6e7ff9561d92 100644
--- a/drivers/input/misc/yealink.c
+++ b/drivers/input/misc/yealink.c
@@ -875,6 +875,10 @@ static int usb_probe(struct usb_interface *intf, const struct usb_device_id *id)
int ret, pipe, i;
interface = intf->cur_altsetting;
+
+ if (interface->desc.bNumEndpoints < 1)
+ return -ENODEV;
+
endpoint = &interface->endpoint[0].desc;
if (!usb_endpoint_is_int_in(endpoint))
return -ENODEV;
--
2.12.0
next prev parent reply other threads:[~2017-03-13 12:35 UTC|newest]
Thread overview: 17+ 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 ` [PATCH 1/7] Input: iforce - fix NULL-deref " Johan Hovold
[not found] ` <20170313123539.28103-1-johan-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2017-03-13 12:35 ` [PATCH 2/7] Input: cm109 " Johan Hovold
2017-03-13 12:35 ` Johan Hovold
2017-03-13 15:15 ` [PATCH 0/7] Input: fix NULL-derefs " Oliver Neukum
2017-03-13 15:15 ` 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
2017-03-18 9:13 ` Johan Hovold
2017-03-13 12:35 ` [PATCH 3/7] Input: ims-pcu - fix NULL-deref " Johan Hovold
2017-03-13 12:35 ` Johan Hovold [this message]
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
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-5-johan@kernel.org \
--to=johan@kernel.org \
--cc=Henk.Vergonet@gmail.com \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.