Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp415400pxj; Thu, 20 May 2021 12:17:15 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxf6k6p4oZUKk8G93bYswITQZ3pz1oxJKpQFF/GIjkJDkgnGdY6STCx1Z8GKIH8dF4yVVpS X-Received: by 2002:a05:6402:111a:: with SMTP id u26mr6494882edv.260.1621538235532; Thu, 20 May 2021 12:17:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621538235; cv=none; d=google.com; s=arc-20160816; b=W/I5oBhtH18LwxW4ek0Fz4J4c4BX8lFLkhAMIx3QAqsh+w/wfsWuGkASNWeReIHWQF UBHKPMQbNBY5KS2j55VUE9idyUrBXDraupfiVPKdnqktJ9Bd+njDbUTI1GAi/hB2XjDr ClP+YjtXTkpUM4TzqvwSK7l4jcWzlVCLGNtAr2kqJ8epHeItb3uZYPV8BF3uVFu4gLYF 2LIc+YChBLLPe/yhiwY3565HdNAMSA3fZylwlgmiEjNX4bkMxFRK0TQ4EeQIHS4T7Tkh /6vyr/kh3qvmcI2vvGIpsnqe8XjhlEeujO5bi+pZJMVKQtm6E3S4wpXs/OutI98O5UCs TzZw== 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=/jfJy8kUSE7Oo2zF+cE4uXhFiwHQKKx733DtAW/mKzY=; b=e9M3fkvwU0NCB0li/gHOffesWu4Wh3mVMaElCcCVN6/+r8ESnSWQHefA1jS++WOwXC 1JwL7IUDNTryV46zLaHtsQhidWhoC0R+WdZwkQwhF6xeI9sDoJvVOCUOfeWXW3TZdv+5 6SDwlbvmfRuY3zqefujAWEIY+At63VHwlf2RKi/7K0+0rQG3z1HSXUXCcjnWqXxAK/YH 7ONWfb54dwMRpFx2VsyDz8gh43lNTiDJVJ7uBY06k2Q4pHl2Rys9V1QOsKLdeInnHbqY JAKeYCMKUVRYJYAa05wed5AbQXZKP/jNzObQu9z3GLsiibDbX6bux9AH98oA+KctRt49 sdnQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=l1B9WdzR; 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 m5si3161404ejo.329.2021.05.20.12.16.50; Thu, 20 May 2021 12:17:15 -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=l1B9WdzR; 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 S237272AbhETKms (ORCPT + 99 others); Thu, 20 May 2021 06:42:48 -0400 Received: from mail.kernel.org ([198.145.29.99]:55680 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235702AbhETK1m (ORCPT ); Thu, 20 May 2021 06:27:42 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 6A4F561C1B; Thu, 20 May 2021 09:50:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1621504230; bh=LiH4zouOVu0MMVsqUCwJLNB9d1Sy0bVzZSgVtiPIXsA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=l1B9WdzReJneakp5t0LnM5GatbbKLtNcEhVHJe9fwi8svUngTmbLERzJx6jcOBXvA +QdNrV8zlSDDbOgOSHb2OQWiA1yO22tN2eOOoyCPba4phSXNT+h9WK7xqa79riMxM/ QU1f1y2GhMB6rlNSsmLxJazYOylkYbu1/59l8VWo= 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.14 151/323] fotg210-udc: Fix DMA on EP0 for length > max packet size Date: Thu, 20 May 2021 11:20:43 +0200 Message-Id: <20210520092125.279358759@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210520092120.115153432@linuxfoundation.org> References: <20210520092120.115153432@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 6866a0be249e..bc79bf46acc4 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