diff mbox series

[v2,2/3] usb: gadget: net2280: Fix net2280_dequeue()

Message ID 20190318081834.4601-2-guido@kiener-muenchen.de (mailing list archive)
State Superseded
Commit f1d3fba17cd4eeea20397f1324b7b9c69a6a935c
Headers show
Series [v2,1/3] usb: gadget: net2280: Fix overrun of OUT messages | expand

Commit Message

Guido Kiener March 18, 2019, 8:18 a.m. UTC
When a request must be dequeued with net2280_dequeue() e.g. due
to a device clear action and the same request is finished by the
function scan_dma_completions() then the function net2280_dequeue()
does not find the request in the following search loop and
returns the error -EINVAL without restoring the status ep->stopped.
Thus the endpoint keeps blocked and does not receive any data
anymore.
This fix restores the status and does not issue an error message.

Signed-off-by: Guido Kiener <guido.kiener@rohde-schwarz.com>
---
 drivers/usb/gadget/udc/net2280.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Alan Stern March 18, 2019, 3:38 p.m. UTC | #1
On Mon, 18 Mar 2019, Guido Kiener wrote:

> When a request must be dequeued with net2280_dequeue() e.g. due
> to a device clear action and the same request is finished by the
> function scan_dma_completions() then the function net2280_dequeue()
> does not find the request in the following search loop and
> returns the error -EINVAL without restoring the status ep->stopped.
> Thus the endpoint keeps blocked and does not receive any data
> anymore.
> This fix restores the status and does not issue an error message.
> 
> Signed-off-by: Guido Kiener <guido.kiener@rohde-schwarz.com>
> ---
>  drivers/usb/gadget/udc/net2280.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/usb/gadget/udc/net2280.c b/drivers/usb/gadget/udc/net2280.c
> index e0b413e9e532..898339e5df10 100644
> --- a/drivers/usb/gadget/udc/net2280.c
> +++ b/drivers/usb/gadget/udc/net2280.c
> @@ -1273,9 +1273,9 @@ static int net2280_dequeue(struct usb_ep *_ep, struct usb_request *_req)
>  			break;
>  	}
>  	if (&req->req != _req) {
> +		ep->stopped = stopped;
>  		spin_unlock_irqrestore(&ep->dev->lock, flags);
> -		dev_err(&ep->dev->pdev->dev, "%s: Request mismatch\n",
> -								__func__);
> +		ep_dbg(ep->dev, "%s: Request mismatch\n", __func__);
>  		return -EINVAL;
>  	}

Acked-by: Alan Stern <stern@rowland.harvard.edu>
diff mbox series

Patch

diff --git a/drivers/usb/gadget/udc/net2280.c b/drivers/usb/gadget/udc/net2280.c
index e0b413e9e532..898339e5df10 100644
--- a/drivers/usb/gadget/udc/net2280.c
+++ b/drivers/usb/gadget/udc/net2280.c
@@ -1273,9 +1273,9 @@  static int net2280_dequeue(struct usb_ep *_ep, struct usb_request *_req)
 			break;
 	}
 	if (&req->req != _req) {
+		ep->stopped = stopped;
 		spin_unlock_irqrestore(&ep->dev->lock, flags);
-		dev_err(&ep->dev->pdev->dev, "%s: Request mismatch\n",
-								__func__);
+		ep_dbg(ep->dev, "%s: Request mismatch\n", __func__);
 		return -EINVAL;
 	}