Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1599299 > unrolled thread

[PATCH 0/6] USB: fix missing endpoint sanity checks

Started byJohan Hovold <johan@kernel.org>
First post2017-03-13 13:50 +0100
Last post2017-03-13 14:00 +0100
Articles 6 — 1 participant

Back to article view | Back to linux.kernel


Contents

  [PATCH 0/6] USB: fix missing endpoint sanity checks Johan Hovold <johan@kernel.org> - 2017-03-13 13:50 +0100
    [PATCH 2/6] USB: lvtest: fix NULL-deref at probe Johan Hovold <johan@kernel.org> - 2017-03-13 13:50 +0100
    [PATCH 4/6] USB: wusbcore: fix NULL-deref at probe Johan Hovold <johan@kernel.org> - 2017-03-13 13:50 +0100
    [PATCH 5/6] uwb: hwa-rc: fix NULL-deref at probe Johan Hovold <johan@kernel.org> - 2017-03-13 14:00 +0100
    [PATCH 6/6] uwb: i1480-dfu: fix NULL-deref at probe Johan Hovold <johan@kernel.org> - 2017-03-13 14:00 +0100
    [PATCH 1/6] USB: idmouse: fix NULL-deref at probe Johan Hovold <johan@kernel.org> - 2017-03-13 14:00 +0100

#1599299 — [PATCH 0/6] USB: fix missing endpoint sanity checks

FromJohan Hovold <johan@kernel.org>
Date2017-03-13 13:50 +0100
Subject[PATCH 0/6] USB: fix missing endpoint sanity checks
Message-ID<tkxAd-ys-7@gated-at.bofh.it>
This series fixes a number of NULL-pointer dereferences due to missing
endpoint sanity checks that can be triggered by a malicious device.

Johan


Johan Hovold (6):
  USB: idmouse: fix NULL-deref at probe
  USB: lvtest: fix NULL-deref at probe
  USB: uss720: fix NULL-deref at probe
  USB: wusbcore: fix NULL-deref at probe
  uwb: hwa-rc: fix NULL-deref at probe
  uwb: i1480-dfu: fix NULL-deref at probe

 drivers/usb/misc/idmouse.c   | 3 +++
 drivers/usb/misc/lvstest.c   | 4 ++++
 drivers/usb/misc/uss720.c    | 5 +++++
 drivers/usb/wusbcore/wa-hc.c | 3 +++
 drivers/uwb/hwa-rc.c         | 3 +++
 drivers/uwb/i1480/dfu/usb.c  | 3 +++
 6 files changed, 21 insertions(+)

-- 
2.12.0

[toc] | [next] | [standalone]


#1599304 — [PATCH 2/6] USB: lvtest: fix NULL-deref at probe

FromJohan Hovold <johan@kernel.org>
Date2017-03-13 13:50 +0100
Subject[PATCH 2/6] USB: lvtest: fix NULL-deref at probe
Message-ID<tkxAe-ys-33@gated-at.bofh.it>
In reply to#1599299
Make sure to check the number of endpoints to avoid dereferencing a
NULL-pointer should the probed device lack endpoints.

Note that this driver does not bind to any devices by default.

Fixes: ce21bfe603b3 ("USB: Add LVS Test device driver")
Cc: stable <stable@vger.kernel.org>     # 3.17
Cc: Pratyush Anand <pratyush.anand@gmail.com>
Signed-off-by: Johan Hovold <johan@kernel.org>
---
 drivers/usb/misc/lvstest.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/usb/misc/lvstest.c b/drivers/usb/misc/lvstest.c
index 77176511658f..d3d124753266 100644
--- a/drivers/usb/misc/lvstest.c
+++ b/drivers/usb/misc/lvstest.c
@@ -366,6 +366,10 @@ static int lvs_rh_probe(struct usb_interface *intf,
 
 	hdev = interface_to_usbdev(intf);
 	desc = intf->cur_altsetting;
+
+	if (desc->desc.bNumEndpoints < 1)
+		return -ENODEV;
+
 	endpoint = &desc->endpoint[0].desc;
 
 	/* valid only for SS root hub */
-- 
2.12.0

[toc] | [prev] | [next] | [standalone]


#1599314 — [PATCH 4/6] USB: wusbcore: fix NULL-deref at probe

FromJohan Hovold <johan@kernel.org>
Date2017-03-13 13:50 +0100
Subject[PATCH 4/6] USB: wusbcore: fix NULL-deref at probe
Message-ID<tkxAf-ys-57@gated-at.bofh.it>
In reply to#1599299
Make sure to check the number of endpoints to avoid dereferencing a
NULL-pointer or accessing memory beyond the endpoint array should a
malicious device lack the expected endpoints.

This specifically fixes the NULL-pointer dereference when probing HWA HC
devices.

Fixes: df3654236e31 ("wusb: add the Wire Adapter (WA) core")
Cc: stable <stable@vger.kernel.org>     # 2.6.28
Cc: Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
Cc: David Vrabel <david.vrabel@csr.com>
Signed-off-by: Johan Hovold <johan@kernel.org>
---
 drivers/usb/wusbcore/wa-hc.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/usb/wusbcore/wa-hc.c b/drivers/usb/wusbcore/wa-hc.c
index 252c7bd9218a..d01496fd27fe 100644
--- a/drivers/usb/wusbcore/wa-hc.c
+++ b/drivers/usb/wusbcore/wa-hc.c
@@ -39,6 +39,9 @@ int wa_create(struct wahc *wa, struct usb_interface *iface,
 	int result;
 	struct device *dev = &iface->dev;
 
+	if (iface->cur_altsetting->desc.bNumEndpoints < 3)
+		return -ENODEV;
+
 	result = wa_rpipes_create(wa);
 	if (result < 0)
 		goto error_rpipes_create;
-- 
2.12.0

[toc] | [prev] | [next] | [standalone]


#1599321 — [PATCH 5/6] uwb: hwa-rc: fix NULL-deref at probe

FromJohan Hovold <johan@kernel.org>
Date2017-03-13 14:00 +0100
Subject[PATCH 5/6] uwb: hwa-rc: fix NULL-deref at probe
Message-ID<tkxJT-Fd-7@gated-at.bofh.it>
In reply to#1599299
Make sure to check the number of endpoints to avoid dereferencing a
NULL-pointer should a malicious device lack endpoints.

Note that the dereference happens in the start callback which is called
during probe.

Fixes: de520b8bd552 ("uwb: add HWA radio controller driver")
Cc: stable <stable@vger.kernel.org>     # 2.6.28
Cc: Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
Cc: David Vrabel <david.vrabel@csr.com>
Signed-off-by: Johan Hovold <johan@kernel.org>
---
 drivers/uwb/hwa-rc.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/uwb/hwa-rc.c b/drivers/uwb/hwa-rc.c
index 0aa6c3c29d17..35a1e777b449 100644
--- a/drivers/uwb/hwa-rc.c
+++ b/drivers/uwb/hwa-rc.c
@@ -823,6 +823,9 @@ static int hwarc_probe(struct usb_interface *iface,
 	struct hwarc *hwarc;
 	struct device *dev = &iface->dev;
 
+	if (iface->cur_altsetting->desc.bNumEndpoints < 1)
+		return -ENODEV;
+
 	result = -ENOMEM;
 	uwb_rc = uwb_rc_alloc();
 	if (uwb_rc == NULL) {
-- 
2.12.0

[toc] | [prev] | [next] | [standalone]


#1599330 — [PATCH 6/6] uwb: i1480-dfu: fix NULL-deref at probe

FromJohan Hovold <johan@kernel.org>
Date2017-03-13 14:00 +0100
Subject[PATCH 6/6] uwb: i1480-dfu: fix NULL-deref at probe
Message-ID<tkxJU-Fd-39@gated-at.bofh.it>
In reply to#1599299
Make sure to check the number of endpoints to avoid dereferencing a
NULL-pointer should a malicious device lack endpoints.

Note that the dereference happens in the cmd and wait_init_done
callbacks which are called during probe.

Fixes: 1ba47da52712 ("uwb: add the i1480 DFU driver")
Cc: stable <stable@vger.kernel.org>     # 2.6.28
Cc: Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
Cc: David Vrabel <david.vrabel@csr.com>
Signed-off-by: Johan Hovold <johan@kernel.org>
---
 drivers/uwb/i1480/dfu/usb.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/uwb/i1480/dfu/usb.c b/drivers/uwb/i1480/dfu/usb.c
index 2bfc846ac071..6345e85822a4 100644
--- a/drivers/uwb/i1480/dfu/usb.c
+++ b/drivers/uwb/i1480/dfu/usb.c
@@ -362,6 +362,9 @@ int i1480_usb_probe(struct usb_interface *iface, const struct usb_device_id *id)
 				 result);
 	}
 
+	if (iface->cur_altsetting->desc.bNumEndpoints < 1)
+		return -ENODEV;
+
 	result = -ENOMEM;
 	i1480_usb = kzalloc(sizeof(*i1480_usb), GFP_KERNEL);
 	if (i1480_usb == NULL) {
-- 
2.12.0

[toc] | [prev] | [next] | [standalone]


#1599332 — [PATCH 1/6] USB: idmouse: fix NULL-deref at probe

FromJohan Hovold <johan@kernel.org>
Date2017-03-13 14:00 +0100
Subject[PATCH 1/6] USB: idmouse: fix NULL-deref at probe
Message-ID<tkxJV-Fd-41@gated-at.bofh.it>
In reply to#1599299
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/usb/misc/idmouse.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/usb/misc/idmouse.c b/drivers/usb/misc/idmouse.c
index 8b9fd7534f69..502bfe30a077 100644
--- a/drivers/usb/misc/idmouse.c
+++ b/drivers/usb/misc/idmouse.c
@@ -347,6 +347,9 @@ static int idmouse_probe(struct usb_interface *interface,
 	if (iface_desc->desc.bInterfaceClass != 0x0A)
 		return -ENODEV;
 
+	if (iface_desc->desc.bNumEndpoints < 1)
+		return -ENODEV;
+
 	/* allocate memory for our device state and initialize it */
 	dev = kzalloc(sizeof(*dev), GFP_KERNEL);
 	if (dev == NULL)
-- 
2.12.0

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web