Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp315864pxj; Thu, 20 May 2021 09:58:07 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx3WlikXJnub1zHwPwLAWxl9L8NBLJ4jTgcLmXbKwwpyjeiA3zHl+4SW9vpdpG7KbGr7IXu X-Received: by 2002:a05:6602:18:: with SMTP id b24mr6146113ioa.1.1621529887156; Thu, 20 May 2021 09:58:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621529887; cv=none; d=google.com; s=arc-20160816; b=xE8edTbubLf6PGPa8Vz1hE+5go7Ns3RF5eO6mcWkO2jOK1NdmTycvzmvZ2MVXKkto0 rSNz6jscPcM0UdbMxcFZvPSmYvaf9owDbz4NMIaxE6ZwRtEpHn3gB6020p+7tRxTncsU DUoUHGwMgwX4ip1vaFHoUxriNnSzKvoBmU+rAfI5rxRF84kSW/tNZ9gob6V2idZbfQx/ 8dnDQCGoRbLF96UfxEdQbPJakjrHfxsVAZQmx0BTP31eNoOrdBS7pr0Yyr6wmxz5N+7E woUPVqipeKE7iealp0T/wAONFa6xaiwBCOKwC3W2fqL9c2JLetpKnOI227cAzlf7+jX7 sCAw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=espL6Cm/Mq0PAV9n3ravnW4ZCpPcDoaor2nz9jNWqHA=; b=xp6uPEfmVyv89w7yMROoj5PGFcBNIxE3jQ21hinvSa2Hq7NSoEOptWVsSMupiGj+zv kLLj81zNZO3C0kFle7TZ3URCrQz4L7wyZDRYzHl1I2G+bG7bJpveCiiyznKwRz1OTBT5 BTYHP6+FVYxHRAxN0U4iNKZ40ccoDCygJ5Sf856OvtNhwq72tD7hIuXpT2siFe6pKLF9 aIvw9uPHzDfYnFOjZXIG6xdohOaY1yqm/VBB5G3RyASvkoo3YrRUkGoB/JY5imcuPUb5 RtQQf888j0LOR4KJLfm5Vybmc0587JnqE61aTMSBVB0FJnkmD/JRfrjFgxnDPJFrio+A M3QQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=YUGN45QZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id l126si3768506iof.101.2021.05.20.09.57.54; Thu, 20 May 2021 09:58:07 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=YUGN45QZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233673AbhETJ6r (ORCPT + 99 others); Thu, 20 May 2021 05:58:47 -0400 Received: from mail.kernel.org ([198.145.29.99]:58652 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234900AbhETJzH (ORCPT ); Thu, 20 May 2021 05:55:07 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id C921C613F7; Thu, 20 May 2021 09:37:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1621503427; bh=NnFm0AF/7+5tRQQwmTk98hsFmyOr8+zRI6AwM+bhRSk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YUGN45QZA3EygQ9i/PS6IqQgBOhOKco2JAdFBvWOLLEgYCVtEHE7gnYq5f8BtbjUF tvp5lzbXqMI4HGZ3v9+YbJaVc+VNPD4NpQFYTIvDF2wb6o34rdooHuOMj74bq0ZcvS 362ReOz/opLzHOZuABZse2FAAt9Z3fFO9jSv8uUA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Fabian Vogt , Sasha Levin Subject: [PATCH 4.19 183/425] fotg210-udc: Fix DMA on EP0 for length > max packet size Date: Thu, 20 May 2021 11:19:12 +0200 Message-Id: <20210520092137.441656456@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210520092131.308959589@linuxfoundation.org> References: <20210520092131.308959589@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Fabian Vogt [ Upstream commit 755915fc28edfc608fa89a163014acb2f31c1e19 ] For a 75 Byte request, it would send the first 64 separately, then detect that the remaining 11 Byte fit into a single DMA, but due to this bug set the length to the original 75 Bytes. This leads to a DMA failure (which is ignored...) and the request completes without the remaining bytes having been sent. Fixes: b84a8dee23fd ("usb: gadget: add Faraday fotg210_udc driver") Signed-off-by: Fabian Vogt Link: https://lore.kernel.org/r/20210324141115.9384-2-fabian@ritter-vogt.de Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- drivers/usb/gadget/udc/fotg210-udc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/usb/gadget/udc/fotg210-udc.c b/drivers/usb/gadget/udc/fotg210-udc.c index bc6abaea907d..d698d4ab121b 100644 --- a/drivers/usb/gadget/udc/fotg210-udc.c +++ b/drivers/usb/gadget/udc/fotg210-udc.c @@ -345,7 +345,7 @@ static void fotg210_start_dma(struct fotg210_ep *ep, if (req->req.length - req->req.actual > ep->ep.maxpacket) length = ep->ep.maxpacket; else - length = req->req.length; + length = req->req.length - req->req.actual; } d = dma_map_single(NULL, buffer, length, -- 2.30.2