Skip to content

Commit 8cf061d

Browse files
AlanSterngregkh
authored andcommitted
usb: usbtest: fix NULL pointer dereference
commit 7c80f9e upstream. 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]> Cc: Ben Hutchings <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent ddd95bc commit 8cf061d

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
@@ -209,12 +209,13 @@ get_endpoints(struct usbtest_dev *dev, struct usb_interface *intf)
209209
return tmp;
210210
}
211211

212-
if (in) {
212+
if (in)
213213
dev->in_pipe = usb_rcvbulkpipe(udev,
214214
in->desc.bEndpointAddress & USB_ENDPOINT_NUMBER_MASK);
215+
if (out)
215216
dev->out_pipe = usb_sndbulkpipe(udev,
216217
out->desc.bEndpointAddress & USB_ENDPOINT_NUMBER_MASK);
217-
}
218+
218219
if (iso_in) {
219220
dev->iso_in = &iso_in->desc;
220221
dev->in_iso_pipe = usb_rcvisocpipe(udev,

0 commit comments

Comments
 (0)