]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
fotg210-udc: Fix EP0 IN requests bigger than two packets
authorFabian Vogt <fabian@ritter-vogt.de>
Wed, 24 Mar 2021 14:11:10 +0000 (15:11 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 22 May 2021 08:59:29 +0000 (10:59 +0200)
[ Upstream commit 078ba935651e149c92c41161e0322e3372cc2705 ]

For a 134 Byte packet, it sends the first two 64 Byte packets just fine,
but then notice that less than a packet is remaining and call fotg210_done
without actually sending the rest.

Fixes: b84a8dee23fd ("usb: gadget: add Faraday fotg210_udc driver")
Signed-off-by: Fabian Vogt <fabian@ritter-vogt.de>
Link: https://lore.kernel.org/r/20210324141115.9384-3-fabian@ritter-vogt.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/usb/gadget/udc/fotg210-udc.c

index d698d4ab121b9dad8bdb9fc7fce0cb9f2aa240c9..a35a55eff429e46e527f2d848c2617681ada0361 100644 (file)
@@ -824,7 +824,7 @@ static void fotg210_ep0in(struct fotg210_udc *fotg210)
                if (req->req.length)
                        fotg210_start_dma(ep, req);
 
-               if ((req->req.length - req->req.actual) < ep->ep.maxpacket)
+               if (req->req.actual == req->req.length)
                        fotg210_done(ep, req, 0);
        } else {
                fotg210_set_cxdone(fotg210);