Skip to content

Commit

Permalink
staging: gigaset: add endpoint-type sanity check
Browse files Browse the repository at this point in the history
Add missing endpoint-type sanity checks to probe.

This specifically prevents a warning in USB core on URB submission when
fuzzing USB descriptors.

Signed-off-by: Johan Hovold <johan@kernel.org>
Cc: stable <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20191202085610.12719-4-johan@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Johan Hovold authored and Greg Kroah-Hartman committed Dec 10, 2019
1 parent 84f60ca commit ed9ed5a
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions drivers/staging/isdn/gigaset/usb-gigaset.c
Original file line number Diff line number Diff line change
Expand Up @@ -705,6 +705,12 @@ static int gigaset_probe(struct usb_interface *interface,

endpoint = &hostif->endpoint[0].desc;

if (!usb_endpoint_is_bulk_out(endpoint)) {
dev_err(&interface->dev, "missing bulk-out endpoint\n");
retval = -ENODEV;
goto error;
}

buffer_size = le16_to_cpu(endpoint->wMaxPacketSize);
ucs->bulk_out_size = buffer_size;
ucs->bulk_out_epnum = usb_endpoint_num(endpoint);
Expand All @@ -724,6 +730,12 @@ static int gigaset_probe(struct usb_interface *interface,

endpoint = &hostif->endpoint[1].desc;

if (!usb_endpoint_is_int_in(endpoint)) {
dev_err(&interface->dev, "missing int-in endpoint\n");
retval = -ENODEV;
goto error;
}

ucs->busy = 0;

ucs->read_urb = usb_alloc_urb(0, GFP_KERNEL);
Expand Down

0 comments on commit ed9ed5a

Please sign in to comment.