Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp2715286imj; Mon, 11 Feb 2019 07:24:33 -0800 (PST) X-Google-Smtp-Source: AHgI3IZnF2HzUPzJxfkZXm6O2wiD1k0PD8AeNJkA+3ZMecFB4o3VOEUJjZuGDHXRbKWH5xTWduk/ X-Received: by 2002:a17:902:e287:: with SMTP id cf7mr16778351plb.51.1549898673695; Mon, 11 Feb 2019 07:24:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549898673; cv=none; d=google.com; s=arc-20160816; b=nOSlN6wJu89FbFpMUqt7rpjqB3vHVfJ538vLBD0tTNcM7PtopleATE0gclzakvKwBQ NRenfxUZRAbDeh0eCc+cdt3UROLMYdvov+rdkoLnRFC3MYQnNvUzArzTrK3byBqC6UKp bpQ23CLsbc2jWdnbzB+bQkrEwcaIcGroCj8+yOhCisGPzRtpbO1Brx9iJFd6Xo6lFUZr zP3hGN8YFIicJb0N81Zxk/YpE7LJxWp+1bKrEc7+Gos+sUQk/gWjSI//XvLc5w5VS4uz bs+UpDvDCSi13L5J0GGHQCnpU6BhRPcLO6kRq/yGzJzFTRjHy81qwNWCmVuo+N6QKwv5 N/iw== 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=sUck1kN4KJciYaHWblnzikptV9T3S0Jxho1YmsrrQpc=; b=ApOOq8at3tnVbzA2DC4tMFa0SDCxUYNrJsjW8ZfgL6QqzDsFbAI00xeiBooWlbu/YA BJwhC+hKrRORsbngkDbmMfzhDL5s3pnWFWL5xN94DPhljp4okih/dzX6IlwuoMLjz6KY HkxymSDGp88ysCNExyJ2Q2vu+YBrBK6LCIl5vD3sJrp6m2wAoq47IfukU3F7i8IBnXHq Hnv/ko1IOPNVs9CXbpJy8LJiV3HaKIUgHh2wQMR5gbDOAKlrZFvpksmu1mZMnCkt+s3C unMpmFlJV1PNFM7yUfiruj8MVI62QgByYDSUk/rL8kJO2ZuYAesNpznFidns+lM2/Y+b TO7g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=FB9yTf4z; 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 cp14si11468527plb.170.2019.02.11.07.24.17; Mon, 11 Feb 2019 07:24:33 -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=FB9yTf4z; 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 S2390006AbfBKPEN (ORCPT + 99 others); Mon, 11 Feb 2019 10:04:13 -0500 Received: from mail.kernel.org ([198.145.29.99]:53086 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390668AbfBKPEK (ORCPT ); Mon, 11 Feb 2019 10:04:10 -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 83D42222A7; Mon, 11 Feb 2019 15:04:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1549897450; bh=XS1UvPpMyic+D+vvOkncGgjSTFnTIeUoQJaJUKzkQ48=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FB9yTf4zXrlsmiLYl0+fGh1H/KpWPUPkYJ7OttqieF9VtMj5lj5XBrhspdmk2azot 7TG0E2j4qyqktUpqhtZssf2GeHRJbtlaBgPzGEEoJBbIdixUnULRSvaZufkTwyA39v dJ52hkQzYe0Cw0L7nal4gU+q1cc6/hfSm7N8Q40c= 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.14 186/205] usb: dwc3: gadget: Handle 0 xfer length for OUT EP Date: Mon, 11 Feb 2019 15:19:44 +0100 Message-Id: <20190211141840.564258507@linuxfoundation.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190211141827.214852402@linuxfoundation.org> References: <20190211141827.214852402@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.14-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 @@ -1114,7 +1114,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;