stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/7] Input: iforce - fix NULL-deref at probe
       [not found] <20170313123539.28103-1-johan@kernel.org>
@ 2017-03-13 12:35 ` Johan Hovold
  2017-03-13 12:35 ` [PATCH 2/7] Input: cm109 " Johan Hovold
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 7+ messages in thread
From: Johan Hovold @ 2017-03-13 12:35 UTC (permalink / raw)
  To: Dmitry Torokhov
  Cc: linux-input, linux-usb, linux-kernel, Johan Hovold, stable

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

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 2/7] Input: cm109 - fix NULL-deref at probe
       [not found] <20170313123539.28103-1-johan@kernel.org>
  2017-03-13 12:35 ` [PATCH 1/7] Input: iforce - fix NULL-deref at probe Johan Hovold
@ 2017-03-13 12:35 ` Johan Hovold
  2017-03-13 12:35 ` [PATCH 3/7] Input: ims-pcu " Johan Hovold
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 7+ messages in thread
From: Johan Hovold @ 2017-03-13 12:35 UTC (permalink / raw)
  To: Dmitry Torokhov
  Cc: linux-input, linux-usb, linux-kernel, Johan Hovold, stable,
	Alfred E . Heggestad

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

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 3/7] Input: ims-pcu - fix NULL-deref at probe
       [not found] <20170313123539.28103-1-johan@kernel.org>
  2017-03-13 12:35 ` [PATCH 1/7] Input: iforce - fix NULL-deref at probe Johan Hovold
  2017-03-13 12:35 ` [PATCH 2/7] Input: cm109 " Johan Hovold
@ 2017-03-13 12:35 ` Johan Hovold
  2017-03-13 12:35 ` [PATCH 4/7] Input: yealink " Johan Hovold
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 7+ messages in thread
From: Johan Hovold @ 2017-03-13 12:35 UTC (permalink / raw)
  To: Dmitry Torokhov
  Cc: linux-input, linux-usb, linux-kernel, Johan Hovold, stable

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

Fixes: 628329d52474 ("Input: add IMS Passenger Control Unit driver")
Cc: stable <stable@vger.kernel.org>	# 3.10
Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Johan Hovold <johan@kernel.org>
---
 drivers/input/misc/ims-pcu.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/input/misc/ims-pcu.c b/drivers/input/misc/ims-pcu.c
index 9c0ea36913b4..f4e8fbec6a94 100644
--- a/drivers/input/misc/ims-pcu.c
+++ b/drivers/input/misc/ims-pcu.c
@@ -1667,6 +1667,10 @@ static int ims_pcu_parse_cdc_data(struct usb_interface *intf, struct ims_pcu *pc
 		return -EINVAL;
 
 	alt = pcu->ctrl_intf->cur_altsetting;
+
+	if (alt->desc.bNumEndpoints < 1)
+		return -ENODEV;
+
 	pcu->ep_ctrl = &alt->endpoint[0].desc;
 	pcu->max_ctrl_size = usb_endpoint_maxp(pcu->ep_ctrl);
 
-- 
2.12.0

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 4/7] Input: yealink - fix NULL-deref at probe
       [not found] <20170313123539.28103-1-johan@kernel.org>
                   ` (2 preceding siblings ...)
  2017-03-13 12:35 ` [PATCH 3/7] Input: ims-pcu " Johan Hovold
@ 2017-03-13 12:35 ` Johan Hovold
  2017-03-13 12:35 ` [PATCH 5/7] Input: hanwang " Johan Hovold
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 7+ messages in thread
From: Johan Hovold @ 2017-03-13 12:35 UTC (permalink / raw)
  To: Dmitry Torokhov
  Cc: linux-input, linux-usb, linux-kernel, Johan Hovold, stable, Henk

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

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 5/7] Input: hanwang - fix NULL-deref at probe
       [not found] <20170313123539.28103-1-johan@kernel.org>
                   ` (3 preceding siblings ...)
  2017-03-13 12:35 ` [PATCH 4/7] Input: yealink " Johan Hovold
@ 2017-03-13 12:35 ` 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
  6 siblings, 0 replies; 7+ messages in thread
From: Johan Hovold @ 2017-03-13 12:35 UTC (permalink / raw)
  To: Dmitry Torokhov
  Cc: linux-input, linux-usb, linux-kernel, Johan Hovold, stable,
	Xing Wei, Jiri Kosina

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

Fixes: bba5394ad3bd ("Input: add support for Hanwang tablets")
Cc: stable <stable@vger.kernel.org>	# 2.6.37
Cc: Xing Wei <weixing@hanwang.com.cn>
Cc: Jiri Kosina <jkosina@suse.cz>
Signed-off-by: Johan Hovold <johan@kernel.org>
---
 drivers/input/tablet/hanwang.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/input/tablet/hanwang.c b/drivers/input/tablet/hanwang.c
index cd852059b99e..df4bea96d7ed 100644
--- a/drivers/input/tablet/hanwang.c
+++ b/drivers/input/tablet/hanwang.c
@@ -340,6 +340,9 @@ static int hanwang_probe(struct usb_interface *intf, const struct usb_device_id
 	int error;
 	int i;
 
+	if (intf->cur_altsetting->desc.bNumEndpoints < 1)
+		return -ENODEV;
+
 	hanwang = kzalloc(sizeof(struct hanwang), GFP_KERNEL);
 	input_dev = input_allocate_device();
 	if (!hanwang || !input_dev) {
-- 
2.12.0

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 6/7] Input: kbtab - fix NULL-deref at probe
       [not found] <20170313123539.28103-1-johan@kernel.org>
                   ` (4 preceding siblings ...)
  2017-03-13 12:35 ` [PATCH 5/7] Input: hanwang " Johan Hovold
@ 2017-03-13 12:35 ` Johan Hovold
  2017-03-13 12:35 ` [PATCH 7/7] Input: sur40 " Johan Hovold
  6 siblings, 0 replies; 7+ messages in thread
From: Johan Hovold @ 2017-03-13 12:35 UTC (permalink / raw)
  To: Dmitry Torokhov
  Cc: linux-input, linux-usb, linux-kernel, Johan Hovold, stable

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

Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Johan Hovold <johan@kernel.org>
---
 drivers/input/tablet/kbtab.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/input/tablet/kbtab.c b/drivers/input/tablet/kbtab.c
index e850d7e8afbc..4d9d64908b59 100644
--- a/drivers/input/tablet/kbtab.c
+++ b/drivers/input/tablet/kbtab.c
@@ -122,6 +122,9 @@ static int kbtab_probe(struct usb_interface *intf, const struct usb_device_id *i
 	struct input_dev *input_dev;
 	int error = -ENOMEM;
 
+	if (intf->cur_altsetting->desc.bNumEndpoints < 1)
+		return -ENODEV;
+
 	kbtab = kzalloc(sizeof(struct kbtab), GFP_KERNEL);
 	input_dev = input_allocate_device();
 	if (!kbtab || !input_dev)
-- 
2.12.0

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 7/7] Input: sur40 - fix NULL-deref at probe
       [not found] <20170313123539.28103-1-johan@kernel.org>
                   ` (5 preceding siblings ...)
  2017-03-13 12:35 ` [PATCH 6/7] Input: kbtab " Johan Hovold
@ 2017-03-13 12:35 ` Johan Hovold
  6 siblings, 0 replies; 7+ messages in thread
From: Johan Hovold @ 2017-03-13 12:35 UTC (permalink / raw)
  To: Dmitry Torokhov
  Cc: linux-input, linux-usb, linux-kernel, Johan Hovold, stable,
	Florian Echtler, David Herrmann, Henrik Rydberg

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: bdb5c57f209c ("Input: add sur40 driver for Samsung SUR40 (aka MS
Surface 2.0/Pixelsense)")
Cc: stable <stable@vger.kernel.org>	# 3.13
Cc: Florian Echtler <floe@butterbrot.org>
Cc: David Herrmann <dh.herrmann@gmail.com>
Cc: Henrik Rydberg <rydberg@euromail.se>

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

diff --git a/drivers/input/touchscreen/sur40.c b/drivers/input/touchscreen/sur40.c
index aefb6e11f88a..4c0eecae065c 100644
--- a/drivers/input/touchscreen/sur40.c
+++ b/drivers/input/touchscreen/sur40.c
@@ -527,6 +527,9 @@ static int sur40_probe(struct usb_interface *interface,
 	if (iface_desc->desc.bInterfaceClass != 0xFF)
 		return -ENODEV;
 
+	if (iface_desc->desc.bNumEndpoints < 5)
+		return -ENODEV;
+
 	/* Use endpoint #4 (0x86). */
 	endpoint = &iface_desc->endpoint[4].desc;
 	if (endpoint->bEndpointAddress != TOUCH_ENDPOINT)
-- 
2.12.0

^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2017-03-13 12:36 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20170313123539.28103-1-johan@kernel.org>
2017-03-13 12:35 ` [PATCH 1/7] Input: iforce - fix NULL-deref at probe Johan Hovold
2017-03-13 12:35 ` [PATCH 2/7] Input: cm109 " 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

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).