stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3] usb: dwc3: gadget: Handle 0 xfer length for OUT EP
@ 2019-01-22  7:56 Tejas Joglekar
  2019-01-28 12:24 ` Tejas Joglekar
  0 siblings, 1 reply; 2+ messages in thread
From: Tejas Joglekar @ 2019-01-22  7:56 UTC (permalink / raw)
  To: Felipe Balbi, linux-usb; +Cc: John Youn, Tejas Joglekar, stable, thinh.nguyen

For OUT endpoints, zero-length transfers require MaxPacketSize buffer as
per the DWC_usb3 programming guide 3.30a section 4.2.3.3.

This patch fixes this by explicitly checking zero length
transfer to correctly pad up to MaxPacketSize.

Fixes: c6267a51639b ("usb: dwc3: gadget: align transfers to wMaxPacketSize")
Cc: stable@vger.kernel.org

Signed-off-by: Tejas Joglekar <joglekar@synopsys.com>
---
Changes in v3:
 - Enclose summary for fixes with " " and no wrap

Changes in v2:
 - Remove sg patch hunk
 - Added fixes and stable tag

 drivers/usb/dwc3/gadget.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
index bed2ff4..6c9b76b 100644
--- a/drivers/usb/dwc3/gadget.c
+++ b/drivers/usb/dwc3/gadget.c
@@ -1119,7 +1119,7 @@ static void dwc3_prepare_one_trb_linear(struct dwc3_ep *dep,
 	unsigned int maxp = usb_endpoint_maxp(dep->endpoint.desc);
 	unsigned int rem = length % maxp;
 
-	if (rem && usb_endpoint_dir_out(dep->endpoint.desc)) {
+	if ((!length || rem) && usb_endpoint_dir_out(dep->endpoint.desc)) {
 		struct dwc3	*dwc = dep->dwc;
 		struct dwc3_trb	*trb;
 
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH v3] usb: dwc3: gadget: Handle 0 xfer length for OUT EP
  2019-01-22  7:56 [PATCH v3] usb: dwc3: gadget: Handle 0 xfer length for OUT EP Tejas Joglekar
@ 2019-01-28 12:24 ` Tejas Joglekar
  0 siblings, 0 replies; 2+ messages in thread
From: Tejas Joglekar @ 2019-01-28 12:24 UTC (permalink / raw)
  To: Felipe Balbi, linux-usb; +Cc: John Youn, stable, Thinh Nguyen

Hi Felipe,
Gentle reminder... any comments on my patch ?

On 1/22/2019 1:27 PM, Tejas Joglekar wrote:
> For OUT endpoints, zero-length transfers require MaxPacketSize buffer as
> per the DWC_usb3 programming guide 3.30a section 4.2.3.3.
>
> This patch fixes this by explicitly checking zero length
> transfer to correctly pad up to MaxPacketSize.
>
> Fixes: c6267a51639b ("usb: dwc3: gadget: align transfers to wMaxPacketSize")
> Cc: stable@vger.kernel.org
>
> Signed-off-by: Tejas Joglekar <joglekar@synopsys.com>
> ---
> Changes in v3:
>  - Enclose summary for fixes with " " and no wrap
>
> Changes in v2:
>  - Remove sg patch hunk
>  - Added fixes and stable tag
>
>  drivers/usb/dwc3/gadget.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
> index bed2ff4..6c9b76b 100644
> --- a/drivers/usb/dwc3/gadget.c
> +++ b/drivers/usb/dwc3/gadget.c
> @@ -1119,7 +1119,7 @@ static void dwc3_prepare_one_trb_linear(struct dwc3_ep *dep,
>  	unsigned int maxp = usb_endpoint_maxp(dep->endpoint.desc);
>  	unsigned int rem = length % maxp;
>  
> -	if (rem && usb_endpoint_dir_out(dep->endpoint.desc)) {
> +	if ((!length || rem) && usb_endpoint_dir_out(dep->endpoint.desc)) {
>  		struct dwc3	*dwc = dep->dwc;
>  		struct dwc3_trb	*trb;
>  

Thanks,

Tejas Joglekar


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-01-28 12:25 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-22  7:56 [PATCH v3] usb: dwc3: gadget: Handle 0 xfer length for OUT EP Tejas Joglekar
2019-01-28 12:24 ` Tejas Joglekar

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).