All of lore.kernel.org
 help / color / mirror / Atom feed
From: Johan Hovold <johan-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
To: Dmitry Torokhov
	<dmitry.torokhov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Cc: linux-input-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-usb-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	Johan Hovold <johan-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
	stable <stable-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	"Alfred E . Heggestad" <aeh-VqIxOk2P1jc@public.gmane.org>
Subject: [PATCH 2/7] Input: cm109 - fix NULL-deref at probe
Date: Mon, 13 Mar 2017 13:35:34 +0100	[thread overview]
Message-ID: <20170313123539.28103-3-johan@kernel.org> (raw)
In-Reply-To: <20170313123539.28103-1-johan-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>

Make sure to check the number of endpoints to avoid dereferencing a
NULL-pointer should a malicious device lack endpoints.

Fixes: c04148f915e5 ("Input: add driver for USB VoIP phones with CM109
chipset")
Cc: stable <stable-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>	# 2.6.28
Cc: Alfred E. Heggestad <aeh-VqIxOk2P1jc@public.gmane.org>

Signed-off-by: Johan Hovold <johan-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
---
 drivers/input/misc/cm109.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/input/misc/cm109.c b/drivers/input/misc/cm109.c
index 9cc6d057c302..23c191a2a071 100644
--- a/drivers/input/misc/cm109.c
+++ b/drivers/input/misc/cm109.c
@@ -700,6 +700,10 @@ static int cm109_usb_probe(struct usb_interface *intf,
 	int error = -ENOMEM;
 
 	interface = intf->cur_altsetting;
+
+	if (interface->desc.bNumEndpoints < 1)
+		return -ENODEV;
+
 	endpoint = &interface->endpoint[0].desc;
 
 	if (!usb_endpoint_is_int_in(endpoint))
-- 
2.12.0

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

WARNING: multiple messages have this Message-ID (diff)
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>,
	"Alfred E . Heggestad" <aeh@db.org>
Subject: [PATCH 2/7] Input: cm109 - fix NULL-deref at probe
Date: Mon, 13 Mar 2017 13:35:34 +0100	[thread overview]
Message-ID: <20170313123539.28103-3-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: c04148f915e5 ("Input: add driver for USB VoIP phones with CM109
chipset")
Cc: stable <stable@vger.kernel.org>	# 2.6.28
Cc: Alfred E. Heggestad <aeh@db.org>

Signed-off-by: Johan Hovold <johan@kernel.org>
---
 drivers/input/misc/cm109.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/input/misc/cm109.c b/drivers/input/misc/cm109.c
index 9cc6d057c302..23c191a2a071 100644
--- a/drivers/input/misc/cm109.c
+++ b/drivers/input/misc/cm109.c
@@ -700,6 +700,10 @@ static int cm109_usb_probe(struct usb_interface *intf,
 	int error = -ENOMEM;
 
 	interface = intf->cur_altsetting;
+
+	if (interface->desc.bNumEndpoints < 1)
+		return -ENODEV;
+
 	endpoint = &interface->endpoint[0].desc;
 
 	if (!usb_endpoint_is_int_in(endpoint))
-- 
2.12.0

  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
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
     [not found] ` <20170313123539.28103-1-johan-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2017-03-13 12:35   ` Johan Hovold [this message]
2017-03-13 12:35     ` [PATCH 2/7] Input: cm109 " 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

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-3-johan@kernel.org \
    --to=johan-dgejt+ai2ygdnm+yrofe0a@public.gmane.org \
    --cc=aeh-VqIxOk2P1jc@public.gmane.org \
    --cc=dmitry.torokhov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=linux-input-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-usb-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=stable-u79uwXL29TY76Z2rM5mHXA@public.gmane.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.