* [PATCH] usb: dwc3: gadget: fix delayed status missing for clear EP halt
@ 2020-12-01 7:22 Li Jun
2020-12-01 17:00 ` Thinh Nguyen
0 siblings, 1 reply; 3+ messages in thread
From: Li Jun @ 2020-12-01 7:22 UTC (permalink / raw)
To: balbi; +Cc: gregkh, Thinh.Nguyen, linux-usb, linux-imx
With several improvements on handling of ClearFeature(halt), there
is one case of delayed status missing: if the xfernotready event
comes after end transfer and clear ep stall command completion,
we can not send the delayed status in dwc3_ep0_send_delayed_status()
as the ep0status is not ready, then in xfernotready event we still
can not send status because delayed_status is still set.
Cc: stable@vger.kernel.org
Fixes: d97c78a1908e ("usb: dwc3: gadget: END_TRANSFER before CLEAR_STALL command")
Signed-off-by: Li Jun <jun.li@nxp.com>
---
drivers/usb/dwc3/ep0.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/drivers/usb/dwc3/ep0.c b/drivers/usb/dwc3/ep0.c
index 7be3903..9580e9f 100644
--- a/drivers/usb/dwc3/ep0.c
+++ b/drivers/usb/dwc3/ep0.c
@@ -1058,10 +1058,16 @@ void dwc3_ep0_send_delayed_status(struct dwc3 *dwc)
{
unsigned int direction = !dwc->ep0_expect_in;
+ /*
+ * If we are ready to send delayed status
+ * but wait status pharse, we can clear
+ * delayed_status flag to let EP0 XferNotReady
+ * handle it as a normal status sending.
+ */
+ dwc->delayed_status = false;
if (dwc->ep0state != EP0_STATUS_PHASE)
return;
- dwc->delayed_status = false;
__dwc3_ep0_do_control_status(dwc, dwc->eps[direction]);
}
--
2.7.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] usb: dwc3: gadget: fix delayed status missing for clear EP halt
2020-12-01 7:22 [PATCH] usb: dwc3: gadget: fix delayed status missing for clear EP halt Li Jun
@ 2020-12-01 17:00 ` Thinh Nguyen
2020-12-02 2:29 ` Jun Li
0 siblings, 1 reply; 3+ messages in thread
From: Thinh Nguyen @ 2020-12-01 17:00 UTC (permalink / raw)
To: Li Jun, balbi@kernel.org
Cc: gregkh@linuxfoundation.org, Thinh Nguyen,
linux-usb@vger.kernel.org, linux-imx@nxp.com
Hi,
Li Jun wrote:
> With several improvements on handling of ClearFeature(halt), there
> is one case of delayed status missing: if the xfernotready event
> comes after end transfer and clear ep stall command completion,
> we can not send the delayed status in dwc3_ep0_send_delayed_status()
> as the ep0status is not ready, then in xfernotready event we still
> can not send status because delayed_status is still set.
>
> Cc: stable@vger.kernel.org
> Fixes: d97c78a1908e ("usb: dwc3: gadget: END_TRANSFER before CLEAR_STALL command")
> Signed-off-by: Li Jun <jun.li@nxp.com>
> ---
> drivers/usb/dwc3/ep0.c | 8 +++++++-
> 1 file changed, 7 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/usb/dwc3/ep0.c b/drivers/usb/dwc3/ep0.c
> index 7be3903..9580e9f 100644
> --- a/drivers/usb/dwc3/ep0.c
> +++ b/drivers/usb/dwc3/ep0.c
> @@ -1058,10 +1058,16 @@ void dwc3_ep0_send_delayed_status(struct dwc3 *dwc)
> {
> unsigned int direction = !dwc->ep0_expect_in;
>
> + /*
> + * If we are ready to send delayed status
> + * but wait status pharse, we can clear
> + * delayed_status flag to let EP0 XferNotReady
> + * handle it as a normal status sending.
> + */
> + dwc->delayed_status = false;
> if (dwc->ep0state != EP0_STATUS_PHASE)
> return;
>
> - dwc->delayed_status = false;
> __dwc3_ep0_do_control_status(dwc, dwc->eps[direction]);
> }
>
This fix is already upstreamed:
fa27e2f6c5e6 ("usb: dwc3: ep0: Fix delay status handling")
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=fa27e2f6c5e674f3f1225f9ca7a7821faaf393bb
Thanks,
Thinh
^ permalink raw reply [flat|nested] 3+ messages in thread
* RE: [PATCH] usb: dwc3: gadget: fix delayed status missing for clear EP halt
2020-12-01 17:00 ` Thinh Nguyen
@ 2020-12-02 2:29 ` Jun Li
0 siblings, 0 replies; 3+ messages in thread
From: Jun Li @ 2020-12-02 2:29 UTC (permalink / raw)
To: Thinh Nguyen, balbi@kernel.org
Cc: gregkh@linuxfoundation.org, linux-usb@vger.kernel.org,
dl-linux-imx
> -----Original Message-----
> From: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
> Sent: Wednesday, December 2, 2020 1:00 AM
> To: Jun Li <jun.li@nxp.com>; balbi@kernel.org
> Cc: gregkh@linuxfoundation.org; Thinh Nguyen <Thinh.Nguyen@synopsys.com>;
> linux-usb@vger.kernel.org; dl-linux-imx <linux-imx@nxp.com>
> Subject: Re: [PATCH] usb: dwc3: gadget: fix delayed status missing for clear
> EP halt
>
> Hi,
>
> Li Jun wrote:
> > With several improvements on handling of ClearFeature(halt), there is
> > one case of delayed status missing: if the xfernotready event comes
> > after end transfer and clear ep stall command completion, we can not
> > send the delayed status in dwc3_ep0_send_delayed_status() as the
> > ep0status is not ready, then in xfernotready event we still can not
> > send status because delayed_status is still set.
> >
> > Cc: stable@vger.kernel.org
> > Fixes: d97c78a1908e ("usb: dwc3: gadget: END_TRANSFER before
> > CLEAR_STALL command")
> > Signed-off-by: Li Jun <jun.li@nxp.com>
> > ---
> > drivers/usb/dwc3/ep0.c | 8 +++++++-
> > 1 file changed, 7 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/usb/dwc3/ep0.c b/drivers/usb/dwc3/ep0.c index
> > 7be3903..9580e9f 100644
> > --- a/drivers/usb/dwc3/ep0.c
> > +++ b/drivers/usb/dwc3/ep0.c
> > @@ -1058,10 +1058,16 @@ void dwc3_ep0_send_delayed_status(struct dwc3
> > *dwc) {
> > unsigned int direction = !dwc->ep0_expect_in;
> >
> > + /*
> > + * If we are ready to send delayed status
> > + * but wait status pharse, we can clear
> > + * delayed_status flag to let EP0 XferNotReady
> > + * handle it as a normal status sending.
> > + */
> > + dwc->delayed_status = false;
> > if (dwc->ep0state != EP0_STATUS_PHASE)
> > return;
> >
> > - dwc->delayed_status = false;
> > __dwc3_ep0_do_control_status(dwc, dwc->eps[direction]); }
> >
>
> This fix is already upstreamed:
> fa27e2f6c5e6 ("usb: dwc3: ep0: Fix delay status handling")
>
> https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgit.k
> ernel.org%2Fpub%2Fscm%2Flinux%2Fkernel%2Fgit%2Ftorvalds%2Flinux.git%2Fc
> ommit%2F%3Fid%3Dfa27e2f6c5e674f3f1225f9ca7a7821faaf393bb&data=04%7C
> 01%7Cjun.li%40nxp.com%7Cb4f70f5eedcc467e0ee708d8961a9f74%7C686ea1d3bc2b
> 4c6fa92cd99c5c301635%7C0%7C0%7C637424388404755873%7CUnknown%7CTWFpbGZsb
> 3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7
> C1000&sdata=6lpOj%2FWUvLc%2FnEYaOoLjYq6JLEqdhmJSmcXpsT8%2Bu0Q%3D&am
> p;reserved=0
Ah, I missed that, so ignore my patch.
Thanks
Li Jun
>
> Thanks,
> Thinh
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-12-02 2:30 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-12-01 7:22 [PATCH] usb: dwc3: gadget: fix delayed status missing for clear EP halt Li Jun
2020-12-01 17:00 ` Thinh Nguyen
2020-12-02 2:29 ` Jun Li
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).