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


Groups > linux.kernel > #1599332

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

From Johan Hovold <johan@kernel.org>
Newsgroups linux.kernel
Subject [PATCH 1/6] USB: idmouse: fix NULL-deref at probe
Date 2017-03-13 14:00 +0100
Message-ID <tkxJV-Fd-41@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 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

Back to linux.kernel | Previous | NextPrevious 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