Skip to content

Commit

Permalink
USB: iowarrior: fix NULL-deref in write
Browse files Browse the repository at this point in the history
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.")
Cc: stable <[email protected]>     # 2.6.21
Signed-off-by: Johan Hovold <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
  • Loading branch information
jhovold authored and gregkh committed Mar 9, 2017
1 parent b7321e8 commit de46e56
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 de46e56

Please sign in to comment.