Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp544685pxj; Thu, 20 May 2021 15:50:41 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz0MOnxDxABxXcsHzSb+HlvQpSu7VqiU4XTStGB3c9Jk2QzUHgYNKp+uWMIZqLvmx3TagsF X-Received: by 2002:a92:c564:: with SMTP id b4mr7725849ilj.257.1621551041151; Thu, 20 May 2021 15:50:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621551041; cv=none; d=google.com; s=arc-20160816; b=ox/AJu80vHAi/is5MK9NJJAl+gQLf2pdYSKZSQgfwWsTPun7yX4OsAYfj4CTzmngIw 0sFrLRPDfnzIkdDd9ljWZXweY/uFt/4J2cHCZ7MTJ5auxOsdAq1SPfGWampmFub+pCjb mrgZAfpYjD9CdtmjafmB4njP2EonUPN9oneWGLsqBUf0mHX7JW9Tq7jZUA0uJBudxYTi MdAbqJghVgTdoVShsAZE9KgBg+sDDsER3U30gzNChq7RvPQgWMsTzMFWPLkVvyLhDe98 Oo1ei/ly+kWIqrWMvDyBDgQ01TOErYu6J/d7cbiqcYCauRGa9KWkPVLIJ+D7ypR+Ac68 EHHQ== 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=XOyFZggB/8NrHVD15zWwbj+p5tC28QQVAbpQUOUYmRc=; b=t9VOszMHswL8S4+uTS0dkmMv+61MtRuNSrMBtEvJmD3iDCrvzkPf+sv7USEGEZR9dK byfSeQr2bCbAWs7UHO6x2sBNnST195GaM8tjyBN3HFdUZIbRIsfy8IEyI2mUNRoe2DWe hFewS3XkS+8b00j6UMASf67GJXF+uY3ply3lcpun6wUK2WXjjyZp7916xO9d3gUHj+60 o1pYQi6LxuTiWxPzj7Gq33DuQjykwYjc8mCo4ZNR5zlR7R16J6WWMOkhKxDyTpHPAzvJ VI05jbo2WKh3oxL+ksX1prLqjHuZWANao5BRD2TnwoiCtmd4C04T4zPfQhwvWICjeHVz P5WA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=LdUrF0iM; 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 c7si3490750jap.0.2021.05.20.15.50.27; Thu, 20 May 2021 15:50:41 -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=LdUrF0iM; 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 S240156AbhETLMh (ORCPT + 99 others); Thu, 20 May 2021 07:12:37 -0400 Received: from mail.kernel.org ([198.145.29.99]:50584 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239228AbhETKws (ORCPT ); Thu, 20 May 2021 06:52:48 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 24273613CE; Thu, 20 May 2021 10:00:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1621504835; bh=w1zepXwKZCJSEghz91NfTQzyP7m84JxtGMbjg+FLY/U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LdUrF0iMVSoApcUbx6HtfDVTT9p1IlwdYjkdVdJ1LkmDfjs4GQgNINAzDHTjOMLE0 zAN/wqLFbXR0DUblGBaiVMdDf4v8qEVc1K1w0nRLXllChlWAwR4LUAB3ZOHrb8kZE5 rNEoHgRVQgG7Iv/nEKtoUnuvvkhyzla+lnjiDL50= 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.9 101/240] fotg210-udc: Fix DMA on EP0 for length > max packet size Date: Thu, 20 May 2021 11:21:33 +0200 Message-Id: <20210520092112.087777739@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210520092108.587553970@linuxfoundation.org> References: <20210520092108.587553970@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 76e991557116..7831c556a40b 100644 --- a/drivers/usb/gadget/udc/fotg210-udc.c +++ b/drivers/usb/gadget/udc/fotg210-udc.c @@ -348,7 +348,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