Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp62248pxj; Thu, 20 May 2021 04:37:27 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyQuyBmh/EdMyxwQI1hGHsb1uf4e2Ws77CJVy5/DiE4NsC0YMD2xFJctcw1jXI48+ZuQJCr X-Received: by 2002:a17:907:2145:: with SMTP id rk5mr4181647ejb.228.1621510647748; Thu, 20 May 2021 04:37:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621510647; cv=none; d=google.com; s=arc-20160816; b=CWuqY1VEGeqO+4WxH43CuZeExm/ntNvozMGuGzvZoEUEJAD1Xvn9LS25qA32nZHvdQ g6DoPLQSekeQrpjwcxIbgzZ25uAj1lDPNZQtOJMovx+Hjxe1DIrxbTPuDVyzNsqNnyX9 TMPJahaCZr3kKGHfOsfKF2OcIFmCYngpZhcD+IAWFSzOLcJdfAbYrQ7cAjGnyjfgEg9e /7KvRBfqJ1ipDijF78shEaHjrLPFQp54D4Zv0Q8Rvdupre59v0jSjDpL/Tf54goLNwSm wYDjmDjhhxAF362vzD60RX1RxNo1F/XS46q/KhKY/POBO68p5C3T2FuA/a3j/1Vvc43f tJ6g== 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=m7TtKVJMy+iBnEN8qfFFsVkXSDit5/8jOxYbhvtOydLq7eLGRdNoij+TQ7uQsL0ta8 l/Otc7PjUbL08FLxx/jLYMd2sYg1ABKN8WJ2VaHD4UqjzxKXfAXpHg57pSOu6R/PRySz K0yNKUp6gs52sMQv8Y6jlVr2NB8a+lCEfwvRaPsqJ82aFSXtdNeUNSluMOuifLAGaSjD sIXu0f/HzI1SSfodIaMqKF2OBkx8XMNCkGiwli60GdB/spDC7H76I0Z9378ZDod8P20e cXE9kbgLSoHhbNIGDlF0R+FMlmRinlLe7E6tZkUdhqSVngtNBu9ZmzSy5110NYf02IMB uYmg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=UZViFlIE; 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 bm18si2047447edb.378.2021.05.20.04.37.04; Thu, 20 May 2021 04:37:27 -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=UZViFlIE; 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 S242306AbhETLfR (ORCPT + 99 others); Thu, 20 May 2021 07:35:17 -0400 Received: from mail.kernel.org ([198.145.29.99]:37860 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240595AbhETLO7 (ORCPT ); Thu, 20 May 2021 07:14:59 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id E0C1C6194C; Thu, 20 May 2021 10:08:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1621505322; bh=w1zepXwKZCJSEghz91NfTQzyP7m84JxtGMbjg+FLY/U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UZViFlIEdWQ4kMHFpFxxkrAaa0NwmPYQNbFQjPzhxRp7Czy9LR9i4sPY3g2OHIx+T RGuE1y6WNjR7C9FdmooECzoq5JBDDrLv7rW/9VXTeCMni7BG9LxhKkBzoAddr0k8Nv Hk4x7GnDED2jJuQiJIqQJ5HUSULRsxIT/4vEoME0= 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.4 083/190] fotg210-udc: Fix DMA on EP0 for length > max packet size Date: Thu, 20 May 2021 11:22:27 +0200 Message-Id: <20210520092104.944253767@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210520092102.149300807@linuxfoundation.org> References: <20210520092102.149300807@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