Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp2661055imj; Mon, 11 Feb 2019 06:38:03 -0800 (PST) X-Google-Smtp-Source: AHgI3IYyGVP40GwRZKKlG6nCEAsr7z/r75pQ61OggN/4D+/xvWEYtXAYgyqItFxnULv/ohngrUsP X-Received: by 2002:a17:902:b701:: with SMTP id d1mr35974053pls.124.1549895883761; Mon, 11 Feb 2019 06:38:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549895883; cv=none; d=google.com; s=arc-20160816; b=tWtLVpCeiw6xSPw4VDWJUe8FPMNV1ON/uy4rIpLT3ogA0v0wp1g7xyymMG2kDcWtHe gN7L8d5zM4UsJEPjhwn7aUdBGJxI0fYehAfSREz1eCMb36yaULNFt3pCB6kFrCOq2ifG e1ZCg9rQmfnsp5Y9i6N8sfts3Nur4WfKZmxMIdxvMUCEO9AEY494Z9S0G64NyoCp1V8n FzhUD9Zxj9wVnAHcUCy7J7mcMQqAJEHlL8/bQv5HgWbT4OnZEIPOQQ/KPsoeepWhh9rL ZvLAlumA3XA+NnTfen9IPEG+4PaVxSp5lbZ59+VzyJ9UwaqXP/gL8138jlzF4GvAzwMW a8oA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=qq+A+VkIr4efbubmHjOAMj3XXQcBFa943xWjOmh739k=; b=N0WC51fo8NnzuNkkESpXQ30gEdEjnanPm5cw8cV6UaQb4tDkofPPO69FlTwNA0Qftq +TbgRjECuEyALAlnanqSAFgx7W2YCPzTZv2ngYsR5u9dRKgTOEfo6xFTyKj2xV5TJNbJ lIOqOW4bBLXQEqN3EdvU5oMPlXU1stwBJ4LDy2PQQEBolTOcVvGU9SBEPlebZmwtAJLZ YZ7WjwnZalb8Fq8At/Qvi3xrJr4o9SJP9SxjfJTaaPy2O4syrtHjQAQerXXlrP2H5/SE LdkBLcDVmElCHxLzThGxoijKqPgnGU+0kNc8urXkjJjOeHMfUnbOfVAd5O9qxnyzGecR 4XLg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=lvp7cX5T; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j10si8886099pgp.282.2019.02.11.06.37.48; Mon, 11 Feb 2019 06:38:03 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=lvp7cX5T; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731361AbfBKOg7 (ORCPT + 99 others); Mon, 11 Feb 2019 09:36:59 -0500 Received: from mail.kernel.org ([198.145.29.99]:46216 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730424AbfBKOg4 (ORCPT ); Mon, 11 Feb 2019 09:36:56 -0500 Received: from localhost (5356596B.cm-6-7b.dynamic.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 48B1520700; Mon, 11 Feb 2019 14:36:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1549895815; bh=Qq//8KMlA3LxW0lesWlXXBU7fsTAIJz5HbkszRN4Vps=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lvp7cX5TtldlFfRlA7lmCNZffEPoOYUuRa6WKfjcn8PpVoaJYjlvehCw3Qilj5FuC yaWpSf+GdAqNdMIo6qV0DiKEaLtI7n5fIypugdQEPGxK/2GQ9Y0FeQiX23JkTppyKk I8P4h0p6scQzjPlbLsNAGSwnGgWJGiUkJEvd1r54= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Tejas Joglekar , Felipe Balbi Subject: [PATCH 4.20 332/352] usb: dwc3: gadget: Handle 0 xfer length for OUT EP Date: Mon, 11 Feb 2019 15:19:19 +0100 Message-Id: <20190211141908.067235403@linuxfoundation.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190211141846.543045703@linuxfoundation.org> References: <20190211141846.543045703@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review X-Patchwork-Hint: ignore MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.20-stable review patch. If anyone has any objections, please let me know. ------------------ From: Tejas Joglekar commit 1e19cdc8060227b0802bda6bc0bd22b23679ba32 upstream. For OUT endpoints, zero-length transfers require MaxPacketSize buffer as per the DWC_usb3 programming guide 3.30a section 4.2.3.3. This patch fixes this by explicitly checking zero length transfer to correctly pad up to MaxPacketSize. Fixes: c6267a51639b ("usb: dwc3: gadget: align transfers to wMaxPacketSize") Cc: stable@vger.kernel.org Signed-off-by: Tejas Joglekar Signed-off-by: Felipe Balbi Signed-off-by: Greg Kroah-Hartman --- drivers/usb/dwc3/gadget.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/usb/dwc3/gadget.c +++ b/drivers/usb/dwc3/gadget.c @@ -1119,7 +1119,7 @@ static void dwc3_prepare_one_trb_linear( unsigned int maxp = usb_endpoint_maxp(dep->endpoint.desc); unsigned int rem = length % maxp; - if (rem && usb_endpoint_dir_out(dep->endpoint.desc)) { + if ((!length || rem) && usb_endpoint_dir_out(dep->endpoint.desc)) { struct dwc3 *dwc = dep->dwc; struct dwc3_trb *trb;