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


Groups > linux.kernel > #1599314

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

From Johan Hovold <johan@kernel.org>
Newsgroups linux.kernel
Subject [PATCH 4/6] USB: wusbcore: fix NULL-deref at probe
Date 2017-03-13 13:50 +0100
Message-ID <tkxAf-ys-57@gated-at.bofh.it> (permalink)
References <tkxAd-ys-7@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[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

csiph-web