From: Felipe Balbi <balbi@kernel.org>
To: Thinh Nguyen <Thinh.Nguyen@synopsys.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
linux-usb@vger.kernel.org
Cc: John Youn <John.Youn@synopsys.com>,
Thinh Nguyen <Thinh.Nguyen@synopsys.com>,
stable@vger.kernel.org
Subject: Re: [PATCH v2] usb: dwc3: gadget: Clear wait flag on dequeue
Date: Tue, 05 Jan 2021 14:58:51 +0200 [thread overview]
Message-ID: <87turvczg4.fsf@kernel.org> (raw)
In-Reply-To: <b81cd5b5281cfbfdadb002c4bcf5c9be7c017cfd.1609828485.git.Thinh.Nguyen@synopsys.com>
Hi,
Thinh Nguyen <Thinh.Nguyen@synopsys.com> writes:
> If an active transfer is dequeued, then the endpoint is freed to start a
> new transfer. Make sure to clear the endpoint's transfer wait flag for
> this case.
>
> Cc: stable@vger.kernel.org
> Fixes: e0d19563eb6c ("usb: dwc3: gadget: Wait for transfer completion")
> Signed-off-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
> ---
> Changes in v2:
> - Only clear the wait flag if the selected request is of an active transfer.
> Otherwise, any dequeue will change the endpoint's state even if it's for
> some random request.
>
> drivers/usb/dwc3/gadget.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
> index 78cb4db8a6e4..9a00dcaca010 100644
> --- a/drivers/usb/dwc3/gadget.c
> +++ b/drivers/usb/dwc3/gadget.c
> @@ -1763,6 +1763,8 @@ static int dwc3_gadget_ep_dequeue(struct usb_ep *ep,
> list_for_each_entry_safe(r, t, &dep->started_list, list)
> dwc3_gadget_move_cancelled_request(r);
>
> + dep->flags &= ~DWC3_EP_WAIT_TRANSFER_COMPLETE;
I'm not sure this is correct. This could create a race condition between
clearing this bit and getting the transfer complete interrupt. It also
seems to break the assumptions made by
dwc3_gadget_endpoint_trbs_complete() (actually its users), specially
regarding ISOC endpoints.
Have you verified all transfer types with this commit?
--
balbi
next prev parent reply other threads:[~2021-01-05 12:59 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-01-05 6:42 [PATCH v2] usb: dwc3: gadget: Clear wait flag on dequeue Thinh Nguyen
2021-01-05 12:58 ` Felipe Balbi [this message]
2021-01-05 13:29 ` Thinh Nguyen
2021-01-05 13:35 ` Felipe Balbi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87turvczg4.fsf@kernel.org \
--to=balbi@kernel.org \
--cc=John.Youn@synopsys.com \
--cc=Thinh.Nguyen@synopsys.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-usb@vger.kernel.org \
--cc=stable@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox