All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] usb: dwc3: gadget: Handle 0 xfer length for OUT EP
@ 2019-01-21  9:33 ` Tejas Joglekar
  0 siblings, 0 replies; 6+ messages in thread
From: Tejas Joglekar @ 2019-01-21  9:33 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 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] 6+ messages in thread

* [v2] usb: dwc3: gadget: Handle 0 xfer length for OUT EP
@ 2019-01-21  9:33 ` Tejas Joglekar
  0 siblings, 0 replies; 6+ messages in thread
From: Tejas Joglekar @ 2019-01-21  9:33 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 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;
 

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

* Re: [PATCH v2] usb: dwc3: gadget: Handle 0 xfer length for OUT EP
@ 2019-01-21 16:17   ` Sergei Shtylyov
  0 siblings, 0 replies; 6+ messages in thread
From: Sergei Shtylyov @ 2019-01-21 16:17 UTC (permalink / raw)
  To: Tejas Joglekar, Felipe Balbi, linux-usb; +Cc: John Youn, stable, thinh.nguyen

Hello!

On 01/21/2019 12:33 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)

   Please enclose the summary in (""), no just (). And please never wrap it.

> Cc: stable@vger.kernel.org
> 
> Signed-off-by: Tejas Joglekar <joglekar@synopsys.com>
[...]

MBR, Sergei

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

* [v2] usb: dwc3: gadget: Handle 0 xfer length for OUT EP
@ 2019-01-21 16:17   ` Sergei Shtylyov
  0 siblings, 0 replies; 6+ messages in thread
From: Sergei Shtylyov @ 2019-01-21 16:17 UTC (permalink / raw)
  To: Tejas Joglekar, Felipe Balbi, linux-usb; +Cc: John Youn, stable, thinh.nguyen

Hello!

On 01/21/2019 12:33 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)

   Please enclose the summary in (""), no just (). And please never wrap it.

> Cc: stable@vger.kernel.org
> 
> Signed-off-by: Tejas Joglekar <joglekar@synopsys.com>
[...]

MBR, Sergei

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

* Re: [PATCH v2] usb: dwc3: gadget: Handle 0 xfer length for OUT EP
@ 2019-01-22  4:28     ` Tejas Joglekar
  0 siblings, 0 replies; 6+ messages in thread
From: Tejas Joglekar @ 2019-01-22  4:28 UTC (permalink / raw)
  To: Sergei Shtylyov, Tejas Joglekar, Felipe Balbi, linux-usb
  Cc: John Youn, stable, thinh.nguyen

Hi,
On 1/21/2019 9:47 PM, Sergei Shtylyov wrote:
> Hello!
>
> On 01/21/2019 12:33 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)
>    Please enclose the summary in (""), no just (). And please never wrap it.
Sure, I will send v3.
>> Cc: stable@vger.kernel.org
>>
>> Signed-off-by: Tejas Joglekar <joglekar@synopsys.com>
> [...]
>
> MBR, Sergei
>
Thanks & Regards,

Tejas Joglekar


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

* [v2] usb: dwc3: gadget: Handle 0 xfer length for OUT EP
@ 2019-01-22  4:28     ` Tejas Joglekar
  0 siblings, 0 replies; 6+ messages in thread
From: Tejas Joglekar @ 2019-01-22  4:28 UTC (permalink / raw)
  To: Sergei Shtylyov, Tejas Joglekar, Felipe Balbi, linux-usb
  Cc: John Youn, stable, thinh.nguyen

Hi,
On 1/21/2019 9:47 PM, Sergei Shtylyov wrote:
> Hello!
>
> On 01/21/2019 12:33 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)
>    Please enclose the summary in (""), no just (). And please never wrap it.
Sure, I will send v3.
>> Cc: stable@vger.kernel.org
>>
>> Signed-off-by: Tejas Joglekar <joglekar@synopsys.com>
> [...]
>
> MBR, Sergei
>
Thanks & Regards,

Tejas Joglekar

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

end of thread, other threads:[~2019-01-22  4:29 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-21  9:33 [PATCH v2] usb: dwc3: gadget: Handle 0 xfer length for OUT EP Tejas Joglekar
2019-01-21  9:33 ` [v2] " Tejas Joglekar
2019-01-21 16:17 ` [PATCH v2] " Sergei Shtylyov
2019-01-21 16:17   ` [v2] " Sergei Shtylyov
2019-01-22  4:28   ` [PATCH v2] " Tejas Joglekar
2019-01-22  4:28     ` [v2] " Tejas Joglekar

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.