]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commitdiff
staging: dwc2: validate urb->actual_length for OUT endpoints
authorPaul Zimmerman <Paul.Zimmerman@synopsys.com>
Mon, 23 Sep 2013 21:23:33 +0000 (14:23 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 25 Sep 2013 23:48:46 +0000 (16:48 -0700)
In dwc2_assign_and_init_hc(), validate urb->actual_length for OUT
endpoints before using the value. This fix is from the Synopsys
vendor driver.

Signed-off-by: Paul Zimmerman <paulz@synopsys.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/dwc2/hcd.c

index da0d35cc33ce7dd3bc79245163b27c3f51fd8bbb..b24540572e921a20cf7a84b8f50af090e9a3a95c 100644 (file)
@@ -780,6 +780,10 @@ static void dwc2_assign_and_init_hc(struct dwc2_hsotg *hsotg,
        chan->data_pid_start = qh->data_toggle;
        chan->multi_count = 1;
 
+       if ((urb->actual_length < 0 || urb->actual_length > urb->length) &&
+           !dwc2_hcd_is_pipe_in(&urb->pipe_info))
+               urb->actual_length = urb->length;
+
        if (hsotg->core_params->dma_enable > 0) {
                chan->xfer_dma = urb->dma + urb->actual_length;