[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20170313124753.28784-3-johan@kernel.org>
Date: Mon, 13 Mar 2017 13:47:49 +0100
From: Johan Hovold <johan@...nel.org>
To: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Cc: linux-usb@...r.kernel.org, linux-kernel@...r.kernel.org,
Johan Hovold <johan@...nel.org>,
stable <stable@...r.kernel.org>,
Pratyush Anand <pratyush.anand@...il.com>
Subject: [PATCH 2/6] USB: lvtest: fix NULL-deref at probe
Make sure to check the number of endpoints to avoid dereferencing a
NULL-pointer should the probed device lack endpoints.
Note that this driver does not bind to any devices by default.
Fixes: ce21bfe603b3 ("USB: Add LVS Test device driver")
Cc: stable <stable@...r.kernel.org> # 3.17
Cc: Pratyush Anand <pratyush.anand@...il.com>
Signed-off-by: Johan Hovold <johan@...nel.org>
---
drivers/usb/misc/lvstest.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/usb/misc/lvstest.c b/drivers/usb/misc/lvstest.c
index 77176511658f..d3d124753266 100644
--- a/drivers/usb/misc/lvstest.c
+++ b/drivers/usb/misc/lvstest.c
@@ -366,6 +366,10 @@ static int lvs_rh_probe(struct usb_interface *intf,
hdev = interface_to_usbdev(intf);
desc = intf->cur_altsetting;
+
+ if (desc->desc.bNumEndpoints < 1)
+ return -ENODEV;
+
endpoint = &desc->endpoint[0].desc;
/* valid only for SS root hub */
--
2.12.0
Powered by blists - more mailing lists