Skip to content

Commit 47f367b

Browse files
AlanSternBrian Maly
authored andcommitted
usb: usbtest: fix NULL pointer dereference
If the usbtest driver encounters a device with an IN bulk endpoint but no OUT bulk endpoint, it will try to dereference a NULL pointer (out->desc.bEndpointAddress). The problem can be solved by adding a missing test. Signed-off-by: Alan Stern <[email protected]> Reported-by: Andrey Konovalov <[email protected]> Tested-by: Andrey Konovalov <[email protected]> Signed-off-by: Felipe Balbi <[email protected]> (cherry picked from commit 7c80f9e) Orabug: 27602321 CVE: CVE-2017-16532 Signed-off-by: Tim Tianyang Chen <[email protected]> Reviewed-by: Jack Vogel <[email protected]> Signed-off-by: Brian Maly <[email protected]>
1 parent 4245aa9 commit 47f367b

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

drivers/usb/misc/usbtest.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,12 +152,13 @@ get_endpoints(struct usbtest_dev *dev, struct usb_interface *intf)
152152
return tmp;
153153
}
154154

155-
if (in) {
155+
if (in)
156156
dev->in_pipe = usb_rcvbulkpipe(udev,
157157
in->desc.bEndpointAddress & USB_ENDPOINT_NUMBER_MASK);
158+
if (out)
158159
dev->out_pipe = usb_sndbulkpipe(udev,
159160
out->desc.bEndpointAddress & USB_ENDPOINT_NUMBER_MASK);
160-
}
161+
161162
if (iso_in) {
162163
dev->iso_in = &iso_in->desc;
163164
dev->in_iso_pipe = usb_rcvisocpipe(udev,

0 commit comments

Comments
 (0)