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


Groups > linux.kernel > #1660306

[PATCH 3.10 185/250] USB: idmouse: fix NULL-deref at probe

Path csiph.com!aioe.org!bofh.it!news.nic.it!robomod
From Willy Tarreau <w@1wt.eu>
Newsgroups linux.kernel
Subject [PATCH 3.10 185/250] USB: idmouse: fix NULL-deref at probe
Date Thu, 08 Jun 2017 01:10:01 +0200
Message-ID <tPSfn-4Fa-1@gated-at.bofh.it> (permalink)
References <tPSfn-4Fa-3@gated-at.bofh.it>
X-Mailer git-send-email 2.8.0.rc2.1.gbe9624a
Sender robomod@news.nic.it
List-ID <linux-kernel.vger.kernel.org>
X-Mailing-List linux-kernel@vger.kernel.org
Approved robomod@news.nic.it
Lines 30
Organization linux.* mail to news gateway
X-Original-Cc Johan Hovold <johan@kernel.org>, Willy Tarreau <w@1wt.eu>
X-Original-Date Thu, 8 Jun 2017 00:59:31 +0200
X-Original-Message-ID <1496876436-32402-186-git-send-email-w@1wt.eu>
X-Original-References <1496876436-32402-1-git-send-email-w@1wt.eu>
X-Original-Sender linux-kernel-owner@vger.kernel.org
Xref csiph.com linux.kernel:1660306

Show key headers only | View raw


From: Johan Hovold <johan@kernel.org>

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>
---
 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 ce97838..3b885c6 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.8.0.rc2.1.gbe9624a

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


Thread

[PATCH 3.10 185/250] USB: idmouse: fix NULL-deref at probe Willy Tarreau <w@1wt.eu> - 2017-06-08 01:10 +0200

csiph-web