diff options
author | Paul Zimmerman <Paul.Zimmerman@synopsys.com> | 2013-09-23 14:23:33 -0700 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-09-25 16:48:46 -0700 |
commit | 84181086342615a8c6cb28901fd8d67939b3c903 (patch) | |
tree | 674202101ee0cc1e95c12575911c09d2e268aaf6 /drivers/staging/dwc2 | |
parent | a4ec93d8b4647358aaa1bde4e1fc055e5f4cf711 (diff) |
staging: dwc2: validate urb->actual_length for OUT endpoints
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>
Diffstat (limited to 'drivers/staging/dwc2')
-rw-r--r-- | drivers/staging/dwc2/hcd.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/staging/dwc2/hcd.c b/drivers/staging/dwc2/hcd.c index da0d35cc33ce..b24540572e92 100644 --- a/drivers/staging/dwc2/hcd.c +++ b/drivers/staging/dwc2/hcd.c @@ -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; |