lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20191230161321.2738541-1-bryan.odonoghue@linaro.org>
Date:   Mon, 30 Dec 2019 16:13:21 +0000
From:   Bryan O'Donoghue <bryan.odonoghue@...aro.org>
To:     balbi@...nel.org, gregkh@...uxfoundation.org,
        linux-usb@...r.kernel.org
Cc:     linux-kernel@...r.kernel.org,
        Bryan O'Donoghue <bryan.odonoghue@...aro.org>
Subject: [PATCH] usb: dwc3: gadget: Fix failure to detect end of transfer

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@...aro.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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ