[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20191113135209.GB20980@duo.ucw.cz>
Date: Wed, 13 Nov 2019 14:52:09 +0100
From: Pavel Machek <pavel@...x.de>
To: pavel@...x.de
Cc: linux-kernel@...r.kernel.org, Roger Quadros <rogerq@...com>,
Felipe Balbi <felipe.balbi@...ux.intel.com>,
Sasha Levin <sashal@...nel.org>
Subject: Re: [PATCH 4.19 113/125] usb: dwc3: gadget: fix race when disabling
ep with cancelled xfers
Hi!
> From: Felipe Balbi <felipe.balbi@...ux.intel.com>
>
> [ Upstream commit d8eca64eec7103ab1fbabc0a187dbf6acfb2af93 ]
>
> When disabling an endpoint which has cancelled requests, we should
> make sure to giveback requests that are currently pending in the
> cancelled list, otherwise we may fall into a situation where command
> completion interrupt fires after endpoint has been disabled, therefore
> causing a splat.
>
> Fixes: fec9095bdef4 "usb: dwc3: gadget: remove wait_end_transfer"
> Reported-by: Roger Quadros <rogerq@...com>
> Signed-off-by: Felipe Balbi <felipe.balbi@...ux.intel.com>
> Link: https://lore.kernel.org/r/20191031090713.1452818-1-felipe.balbi@linux.intel.com
> Signed-off-by: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
> Signed-off-by: Sasha Levin <sashal@...nel.org>
> ---
> drivers/usb/dwc3/gadget.c | 6 ++++++
> 1 file changed, 6 insertions(+)
>
> diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
> index 54de732550648..8398c33d08e7c 100644
> --- a/drivers/usb/dwc3/gadget.c
> +++ b/drivers/usb/dwc3/gadget.c
> @@ -698,6 +698,12 @@ static void dwc3_remove_requests(struct dwc3 *dwc, struct dwc3_ep *dep)
>
> dwc3_gadget_giveback(dep, req, -ESHUTDOWN);
> }
> +
> + while (!list_empty(&dep->cancelled_list)) {
> + req = next_request(&dep->cancelled_list);
> +
> + dwc3_gadget_giveback(dep, req, -ESHUTDOWN);
> + }
> }
This is third copy of a loop. Perhaps it is time to create a helper?
Best regards,
Pavel
--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
Download attachment "signature.asc" of type "application/pgp-signature" (196 bytes)
Powered by blists - more mailing lists