aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohan Hovold <johan@kernel.org>2017-03-13 13:47:48 +0100
committerMoyster <oysterized@gmail.com>2017-06-17 15:54:21 +0200
commit04db8cb58dfe0e587475d62a17c3fdc7aa96f869 (patch)
treeeae49a8bf28b03a17d5358fcb0bd03678d85ce60
parentb56f202371da1cb3f4dab08e7f2475d5356f9af7 (diff)
USB: idmouse: fix NULL-deref at probe
commit b0addd3fa6bcd119be9428996d5d4522479ab240 upstream. 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") Signed-off-by: Johan Hovold <johan@kernel.org> Signed-off-by: Willy Tarreau <w@1wt.eu>
-rw-r--r--drivers/usb/misc/idmouse.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/usb/misc/idmouse.c b/drivers/usb/misc/idmouse.c
index ce978384f..3b885c61b 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)