Skip to content

Commit 7c80f9e

Browse files
AlanSternFelipe Balbi
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]>
1 parent ff74745 commit 7c80f9e

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
@@ -202,12 +202,13 @@ get_endpoints(struct usbtest_dev *dev, struct usb_interface *intf)
202202
return tmp;
203203
}
204204

205-
if (in) {
205+
if (in)
206206
dev->in_pipe = usb_rcvbulkpipe(udev,
207207
in->desc.bEndpointAddress & USB_ENDPOINT_NUMBER_MASK);
208+
if (out)
208209
dev->out_pipe = usb_sndbulkpipe(udev,
209210
out->desc.bEndpointAddress & USB_ENDPOINT_NUMBER_MASK);
210-
}
211+
211212
if (iso_in) {
212213
dev->iso_in = &iso_in->desc;
213214
dev->in_iso_pipe = usb_rcvisocpipe(udev,

0 commit comments

Comments
 (0)