diff options
| author | Johan Hovold <johan@kernel.org> | 2017-03-13 13:47:48 +0100 |
|---|---|---|
| committer | Moyster <oysterized@gmail.com> | 2017-06-17 15:54:21 +0200 |
| commit | 04db8cb58dfe0e587475d62a17c3fdc7aa96f869 (patch) | |
| tree | eae49a8bf28b03a17d5358fcb0bd03678d85ce60 /drivers | |
| parent | b56f202371da1cb3f4dab08e7f2475d5356f9af7 (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>
Diffstat (limited to 'drivers')
| -rw-r--r-- | drivers/usb/misc/idmouse.c | 3 |
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) |
