Skip to content

Commit

Permalink
USB: iowarrior: fix NULL-deref in write
Browse files Browse the repository at this point in the history
commit de46e56 upstream.

Make sure to verify that we have the required interrupt-out endpoint for
IOWarrior56 devices to avoid dereferencing a NULL-pointer in write
should a malicious device lack such an endpoint.

Fixes: 946b960 ("USB: add driver for iowarrior devices.")
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Johan Hovold authored and Greg Kroah-Hartman committed Mar 18, 2017
1 parent 5ec5976 commit 14bca59
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions drivers/usb/misc/iowarrior.c
Original file line number Diff line number Diff line change
Expand Up @@ -798,6 +798,14 @@ static int iowarrior_probe(struct usb_interface *interface,
goto error;
}

if (dev->product_id == USB_DEVICE_ID_CODEMERCS_IOW56) {
if (!dev->int_out_endpoint) {
dev_err(&interface->dev, "no interrupt-out endpoint found\n");
retval = -ENODEV;
goto error;
}
}

/* we have to check the report_size often, so remember it in the endianness suitable for our machine */
dev->report_size = usb_endpoint_maxp(dev->int_in_endpoint);
if ((dev->interface->cur_altsetting->desc.bInterfaceNumber == 0) &&
Expand Down

0 comments on commit 14bca59

Please sign in to comment.