Skip to content

Commit de46c1a

Browse files
AlanSterngregkh
authored andcommitted
usb: usbtest: fix NULL pointer dereference
commit 7c80f9e4a588f1925b07134bb2e3689335f6c6d8 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 <stern@rowland.harvard.edu> Reported-by: Andrey Konovalov <andreyknvl@google.com> Tested-by: Andrey Konovalov <andreyknvl@google.com> Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com> Cc: Ben Hutchings <ben.hutchings@codethink.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent c93df40 commit de46c1a

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

drivers/usb/misc/usbtest.c

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

188-
if (in) {
188+
if (in)
189189
dev->in_pipe = usb_rcvbulkpipe(udev,
190190
in->desc.bEndpointAddress & USB_ENDPOINT_NUMBER_MASK);
191+
if (out)
191192
dev->out_pipe = usb_sndbulkpipe(udev,
192193
out->desc.bEndpointAddress & USB_ENDPOINT_NUMBER_MASK);
193-
}
194+
194195
if (iso_in) {
195196
dev->iso_in = &iso_in->desc;
196197
dev->in_iso_pipe = usb_rcvisocpipe(udev,

0 commit comments

Comments
 (0)