From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id EF98DC2D0CB for ; Sun, 15 Dec 2019 17:18:16 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id BB5412465E for ; Sun, 15 Dec 2019 17:18:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1576430296; bh=lBaXQVDhBlGlffyuK24qEtkZ0lOF2dTznMoC0TZNOCw=; h=Date:From:To:Cc:Subject:References:In-Reply-To:List-ID:From; b=U+rLe4VKFJ5kLGYk8We+Z8HP2qGdD1LInnNpSUdF3F7sUBTCSVBYyBnIHJpinVG8o hUc+LR9FOgvBR0/HJlbEZUndkEGIYMG4Dn3DYxVL7Jkmc8oGwT+yAqwz/SLd2yD7nn rQjffpUU+tCHILqBLE0m7TuIsdvmjGKAiK+rqaKk= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726219AbfLORSQ (ORCPT ); Sun, 15 Dec 2019 12:18:16 -0500 Received: from mail.kernel.org ([198.145.29.99]:34728 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726130AbfLORSP (ORCPT ); Sun, 15 Dec 2019 12:18:15 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.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 A79BE2465E; Sun, 15 Dec 2019 17:18:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1576430295; bh=lBaXQVDhBlGlffyuK24qEtkZ0lOF2dTznMoC0TZNOCw=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=vu3jfGDc8TFDJvDRnJUxmulRWlc3HCPyKpGky/PEdRM5M0NmlN+Hyb2fXmyhMwgoC O4GW4bI1A4k4JGcdRQFnPC+/5+C1Igk8nGkOXdxvOK/pJ6iHhyP6MrJOyH8BdVt6KK wBIj3yIuD256oHq+LIrwnLPHDaLXiMV6Xl1/0ocs= Date: Sun, 15 Dec 2019 18:18:12 +0100 From: Greg Kroah-Hartman To: Thinh Nguyen Cc: Felipe Balbi , "linux-usb@vger.kernel.org" , John Youn , "stable@vger.kernel.org" Subject: Re: [PATCH] usb: dwc3: gadget: Fix request complete check Message-ID: <20191215171812.GA853060@kroah.com> References: <5a7554e4-a12e-d29c-1767-5dd75183922f@synopsys.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <5a7554e4-a12e-d29c-1767-5dd75183922f@synopsys.com> Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org On Sat, Dec 14, 2019 at 03:01:40AM +0000, Thinh Nguyen wrote: > Hi Greg and Felipe, > > Thinh Nguyen wrote: > > We can only check for IN direction if the request had completed. For OUT > > direction, it's perfectly fine that the host can send less than the > > setup length. Let's return true fall all cases of OUT direction. > > > > Fixes: e0c42ce590fe ("usb: dwc3: gadget: simplify IOC handling") > > > > Cc: stable@vger.kernel.org > > Signed-off-by: Thinh Nguyen > > --- > > drivers/usb/dwc3/gadget.c | 7 +++++++ > > 1 file changed, 7 insertions(+) > > > > diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c > > index b3f8514d1f27..edc478c20846 100644 > > --- a/drivers/usb/dwc3/gadget.c > > +++ b/drivers/usb/dwc3/gadget.c > > @@ -2470,6 +2470,13 @@ static int dwc3_gadget_ep_reclaim_trb_linear(struct dwc3_ep *dep, > > > > static bool dwc3_gadget_ep_request_completed(struct dwc3_request *req) > > { > > + /* > > + * For OUT direction, host may send less than the setup > > + * length. Return true for all OUT requests. > > + */ > > + if (!req->direction) > > + return true; > > + > > return req->request.actual == req->request.length; > > } > > > > Not sure if it's too late, but after Tejas's patch* that fixes the SG > check in dwc3, it exposes another issue. Without this patch, quite a few > function drivers will not work with dwc3. > > If we can pick it up before the next merge, it'd be great. What exactly breaks without this patch? And how was the original patch ever tested? thanks, greg k-h