Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp4592312pxj; Wed, 12 May 2021 08:51:26 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxnBrcXiVyr3/scvdNNa/9hQvj5uUy+QFAx/mgBifQtLAGYtFuTDUaoWpd3o844vqBiqm2u X-Received: by 2002:a17:906:c1ca:: with SMTP id bw10mr10977779ejb.512.1620834686702; Wed, 12 May 2021 08:51:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620834686; cv=none; d=google.com; s=arc-20160816; b=Xpn5+grc1EHayrzknHPkjB/09Iq5sBqrn1AuNAjYy6fH0vJbM7slka018u/Jf6Lcts H6fS7+boFks2PYBBfMeJ0Ecpt2N91o9x9z2k1fi/F3NqcBsZwVnGVfMV3KVYijzRueO2 FF0Z3gw2ZkERCE2NzHcR7TeY+TXrpxGbyLlX2qZwTg3AAZ2IuXROZBljnkkv9Rda7mjo ZiQK7BLK+/MoI9UV7+47DmJZiiKFoI7YjFBaKCOdMRtVqYu/mTtU2xKT5yy4jxp8yqsN l2qjV+YdicEDEm0jMdHUh+e/fEHF6D2Ja/VJiYe4FrACDW/WE/vkfBZAsbZWkmxgh/UU j+6Q== 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=dxkVpzsfkgG/jPuctXYlWC9nVZvbnZvWUT0EnhDE3P4=; b=Sb35kd1xWz/q49ppHscoZXiGkeeGwpbHzw3m5D+/rFwnJhqpZLvq7bfBOiaJUaeskj rrxyUbvcNKMf1IR3BHd98rHYRAIFfVZyuPk4YTjBfsRSBLaDWzVAosyU1Cp3D7/hPdlM bxfScEq0V8oUkM01aRXgmVKKcnJIJHYMLW96kpXclinKgWRFgWxPIUQ8Kp3QWE1++cG0 Lxf26GW/YjjGlhN4+ArXcSAp+3V0DvE6DMOe3+it8ddBstMqLQ7C51MYWMm19bMAezPa wS//pXzsTCfHXhI+S7Dxw7x6D24lTCt07PgDpi764HF6n1Q2Zhw9pNTnLqpQNTEh2hpx A4Gg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=K8uuKeKg; 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 lc14si323324ejc.60.2021.05.12.08.51.01; Wed, 12 May 2021 08:51:26 -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=K8uuKeKg; 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 S237321AbhELPtz (ORCPT + 99 others); Wed, 12 May 2021 11:49:55 -0400 Received: from mail.kernel.org ([198.145.29.99]:60086 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233825AbhELPYG (ORCPT ); Wed, 12 May 2021 11:24:06 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 477FB619BE; Wed, 12 May 2021 15:09:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1620832187; bh=paIkBAal57ouLyx6Y8VYkL21J9TMP4bNmhH9Qyd5Mlw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=K8uuKeKg2SCYPmp8phJPvLObZtcz37PJzvR2ov4YVPHMxQU7BCWc3sjQwEvauHSPQ 2xxmtrpQ+CrOhPoS2LzZyCy+od+CqXt+sHo4IScrPMk6qTZtpdlEsVMss1Kb7J9LGW KZ1g3aIo5BL9ssmDa+p1aALd2/M9tgpHONc8fDWI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Fabian Vogt , Sasha Levin Subject: [PATCH 5.10 176/530] fotg210-udc: Fix DMA on EP0 for length > max packet size Date: Wed, 12 May 2021 16:44:46 +0200 Message-Id: <20210512144825.618276094@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210512144819.664462530@linuxfoundation.org> References: <20210512144819.664462530@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 d6ca50f01985..39260007ebf8 100644 --- a/drivers/usb/gadget/udc/fotg210-udc.c +++ b/drivers/usb/gadget/udc/fotg210-udc.c @@ -346,7 +346,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(dev, buffer, length, -- 2.30.2