|
|
af239e2 |
From 7c80f9e4a588f1925b07134bb2e3689335f6c6d8 Mon Sep 17 00:00:00 2001
|
|
|
af239e2 |
From: Alan Stern <stern@rowland.harvard.edu>
|
|
|
af239e2 |
Date: Fri, 29 Sep 2017 10:54:24 -0400
|
|
|
af239e2 |
Subject: [PATCH] usb: usbtest: fix NULL pointer dereference
|
|
|
af239e2 |
|
|
|
af239e2 |
If the usbtest driver encounters a device with an IN bulk endpoint but
|
|
|
af239e2 |
no OUT bulk endpoint, it will try to dereference a NULL pointer
|
|
|
af239e2 |
(out->desc.bEndpointAddress). The problem can be solved by adding a
|
|
|
af239e2 |
missing test.
|
|
|
af239e2 |
|
|
|
af239e2 |
Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
|
|
|
af239e2 |
Reported-by: Andrey Konovalov <andreyknvl@google.com>
|
|
|
af239e2 |
Tested-by: Andrey Konovalov <andreyknvl@google.com>
|
|
|
af239e2 |
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
|
|
|
af239e2 |
---
|
|
|
af239e2 |
drivers/usb/misc/usbtest.c | 5 +++--
|
|
|
af239e2 |
1 file changed, 3 insertions(+), 2 deletions(-)
|
|
|
af239e2 |
|
|
|
af239e2 |
diff --git a/drivers/usb/misc/usbtest.c b/drivers/usb/misc/usbtest.c
|
|
|
af239e2 |
index 113e38bfe0ef..b3fc602b2e24 100644
|
|
|
af239e2 |
--- a/drivers/usb/misc/usbtest.c
|
|
|
af239e2 |
+++ b/drivers/usb/misc/usbtest.c
|
|
|
af239e2 |
@@ -202,12 +202,13 @@ get_endpoints(struct usbtest_dev *dev, struct usb_interface *intf)
|
|
|
af239e2 |
return tmp;
|
|
|
af239e2 |
}
|
|
|
af239e2 |
|
|
|
af239e2 |
- if (in) {
|
|
|
af239e2 |
+ if (in)
|
|
|
af239e2 |
dev->in_pipe = usb_rcvbulkpipe(udev,
|
|
|
af239e2 |
in->desc.bEndpointAddress & USB_ENDPOINT_NUMBER_MASK);
|
|
|
af239e2 |
+ if (out)
|
|
|
af239e2 |
dev->out_pipe = usb_sndbulkpipe(udev,
|
|
|
af239e2 |
out->desc.bEndpointAddress & USB_ENDPOINT_NUMBER_MASK);
|
|
|
af239e2 |
- }
|
|
|
af239e2 |
+
|
|
|
af239e2 |
if (iso_in) {
|
|
|
af239e2 |
dev->iso_in = &iso_in->desc;
|
|
|
af239e2 |
dev->in_iso_pipe = usb_rcvisocpipe(udev,
|
|
|
af239e2 |
--
|
|
|
af239e2 |
2.13.6
|
|
|
af239e2 |
|