* [PATCH] usb: dwc3: gadget: Fix failure to detect end of transfer
@ 2019-12-30 16:13 Bryan O'Donoghue
2019-12-30 18:57 ` Greg KH
0 siblings, 1 reply; 4+ messages in thread
From: Bryan O'Donoghue @ 2019-12-30 16:13 UTC (permalink / raw)
To: balbi, gregkh, linux-usb; +Cc: linux-kernel, Bryan O'Donoghue
A recent bugfix 8c7d4b7b3d43 ("usb: dwc3: gadget: Fix logical condition")
correctly fixes a logical error in the gadget driver but, exposes a further
bug in determining when a transfer has completed.
Prior to 8c7d4b7b3d43 we were calling dwc3_gadget_giveback() when we
shouldn't have been. Afer this change the below test fails to complete on
my hardware.
Host:
echo "host" > /dev/ttyACM0
Device:
cat < /dev/ttyGS0
This is caused by the driver incorrectly detecting end of transfer, a
problem that had previous been masked by the continuous calling of
dwc3_gadget_giveback() prior to 8c7d4b7b3d43.
Remediate by making the test <= instead of ==
Fixes: e0c42ce590fe ("usb: dwc3: gadget: simplify IOC handling")
Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
---
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 0c960a97ea02..464c4d9961c7 100644
--- a/drivers/usb/dwc3/gadget.c
+++ b/drivers/usb/dwc3/gadget.c
@@ -2467,7 +2467,7 @@ static int dwc3_gadget_ep_reclaim_trb_linear(struct dwc3_ep *dep,
static bool dwc3_gadget_ep_request_completed(struct dwc3_request *req)
{
- return req->request.actual == req->request.length;
+ return req->request.actual <= req->request.length;
}
static int dwc3_gadget_ep_cleanup_completed_request(struct dwc3_ep *dep,
--
2.24.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] usb: dwc3: gadget: Fix failure to detect end of transfer
2019-12-30 16:13 [PATCH] usb: dwc3: gadget: Fix failure to detect end of transfer Bryan O'Donoghue
@ 2019-12-30 18:57 ` Greg KH
2019-12-31 0:05 ` Bryan O'Donoghue
0 siblings, 1 reply; 4+ messages in thread
From: Greg KH @ 2019-12-30 18:57 UTC (permalink / raw)
To: Bryan O'Donoghue; +Cc: balbi, linux-usb, linux-kernel
On Mon, Dec 30, 2019 at 04:13:21PM +0000, Bryan O'Donoghue wrote:
> A recent bugfix 8c7d4b7b3d43 ("usb: dwc3: gadget: Fix logical condition")
> correctly fixes a logical error in the gadget driver but, exposes a further
> bug in determining when a transfer has completed.
>
> Prior to 8c7d4b7b3d43 we were calling dwc3_gadget_giveback() when we
> shouldn't have been. Afer this change the below test fails to complete on
> my hardware.
>
> Host:
> echo "host" > /dev/ttyACM0
>
> Device:
> cat < /dev/ttyGS0
>
> This is caused by the driver incorrectly detecting end of transfer, a
> problem that had previous been masked by the continuous calling of
> dwc3_gadget_giveback() prior to 8c7d4b7b3d43.
>
> Remediate by making the test <= instead of ==
>
> Fixes: e0c42ce590fe ("usb: dwc3: gadget: simplify IOC handling")
>
> Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
> ---
> drivers/usb/dwc3/gadget.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
I think this patch:
https://lore.kernel.org/linux-usb/ac5a3593a94fdaa3d92e6352356b5f7a01ccdc7c.1576291140.git.thinhn@synopsys.com/
should fix this issue instead, right?
If not, do I need to include both of these?
thanks,
greg k-h
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] usb: dwc3: gadget: Fix failure to detect end of transfer
2019-12-30 18:57 ` Greg KH
@ 2019-12-31 0:05 ` Bryan O'Donoghue
2019-12-31 0:21 ` Bryan O'Donoghue
0 siblings, 1 reply; 4+ messages in thread
From: Bryan O'Donoghue @ 2019-12-31 0:05 UTC (permalink / raw)
To: Greg KH; +Cc: balbi, linux-usb, linux-kernel
On 30/12/2019 18:57, Greg KH wrote:
> On Mon, Dec 30, 2019 at 04:13:21PM +0000, Bryan O'Donoghue wrote:
>> A recent bugfix 8c7d4b7b3d43 ("usb: dwc3: gadget: Fix logical condition")
>> correctly fixes a logical error in the gadget driver but, exposes a further
>> bug in determining when a transfer has completed.
>>
>> Prior to 8c7d4b7b3d43 we were calling dwc3_gadget_giveback() when we
>> shouldn't have been. Afer this change the below test fails to complete on
>> my hardware.
>>
>> Host:
>> echo "host" > /dev/ttyACM0
>>
>> Device:
>> cat < /dev/ttyGS0
>>
>> This is caused by the driver incorrectly detecting end of transfer, a
>> problem that had previous been masked by the continuous calling of
>> dwc3_gadget_giveback() prior to 8c7d4b7b3d43.
>>
>> Remediate by making the test <= instead of ==
>>
>> Fixes: e0c42ce590fe ("usb: dwc3: gadget: simplify IOC handling")
>>
>> Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
>> ---
>> drivers/usb/dwc3/gadget.c | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> I think this patch:
> https://lore.kernel.org/linux-usb/ac5a3593a94fdaa3d92e6352356b5f7a01ccdc7c.1576291140.git.thinhn@synopsys.com/
>
> should fix this issue instead, right?
>
> If not, do I need to include both of these?
Yep, works fine in isolation.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] usb: dwc3: gadget: Fix failure to detect end of transfer
2019-12-31 0:05 ` Bryan O'Donoghue
@ 2019-12-31 0:21 ` Bryan O'Donoghue
0 siblings, 0 replies; 4+ messages in thread
From: Bryan O'Donoghue @ 2019-12-31 0:21 UTC (permalink / raw)
To: Greg KH; +Cc: balbi, linux-usb, linux-kernel
On 31/12/2019 00:05, Bryan O'Donoghue wrote:
> On 30/12/2019 18:57, Greg KH wrote:
>> On Mon, Dec 30, 2019 at 04:13:21PM +0000, Bryan O'Donoghue wrote:
>>> A recent bugfix 8c7d4b7b3d43 ("usb: dwc3: gadget: Fix logical
>>> condition")
>>> correctly fixes a logical error in the gadget driver but, exposes a
>>> further
>>> bug in determining when a transfer has completed.
>>>
>>> Prior to 8c7d4b7b3d43 we were calling dwc3_gadget_giveback() when we
>>> shouldn't have been. Afer this change the below test fails to
>>> complete on
>>> my hardware.
>>>
>>> Host:
>>> echo "host" > /dev/ttyACM0
>>>
>>> Device:
>>> cat < /dev/ttyGS0
>>>
>>> This is caused by the driver incorrectly detecting end of transfer, a
>>> problem that had previous been masked by the continuous calling of
>>> dwc3_gadget_giveback() prior to 8c7d4b7b3d43.
>>>
>>> Remediate by making the test <= instead of ==
>>>
>>> Fixes: e0c42ce590fe ("usb: dwc3: gadget: simplify IOC handling")
>>>
>>> Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
>>> ---
>>> drivers/usb/dwc3/gadget.c | 2 +-
>>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> I think this patch:
>> https://lore.kernel.org/linux-usb/ac5a3593a94fdaa3d92e6352356b5f7a01ccdc7c.1576291140.git.thinhn@synopsys.com/
>>
>>
>> should fix this issue instead, right?
>>
>> If not, do I need to include both of these?
>
> Yep, works fine in isolation.
>
I don't have that in my inbox anywhere - not sure why, would have saved
me 1/2 a day of work.
Anyway, please feel free to add my
Tested-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org> to Thinh's patch
---
bod
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2019-12-31 0:21 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-12-30 16:13 [PATCH] usb: dwc3: gadget: Fix failure to detect end of transfer Bryan O'Donoghue
2019-12-30 18:57 ` Greg KH
2019-12-31 0:05 ` Bryan O'Donoghue
2019-12-31 0:21 ` Bryan O'Donoghue
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).