Received: by 10.223.164.202 with SMTP id h10csp12137wrb; Mon, 6 Nov 2017 01:32:34 -0800 (PST) X-Google-Smtp-Source: ABhQp+RqErtfIkgnE1zVq97z2cL75pasM9x3N4z4A7RNEoW4QJrAWjxjnPABF4G55jyaiOw1AbeJ X-Received: by 10.99.124.88 with SMTP id l24mr14324053pgn.397.1509960754206; Mon, 06 Nov 2017 01:32:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1509960754; cv=none; d=google.com; s=arc-20160816; b=i789e31wfo+pBD8V39AFH7FVWQrJUBDM+hO9qcjFbe/KZxluxYPG4r+UYMlt8vm8lQ 7tsFCJjTkOaOSmr88ewMQ2j3Y5EHwbPAaZqj4Wbys48YX3l/f9oLURkwX60aEXJYLklM TBGwxWDpOJItqVwj6BDPlaRJu4M6GIC25acfnEmoAeljCe2lo/fVUbqlI7t9DMxTyG9j EfbRUDDemWlOv0BHm2UzL/a5BQxJhcsBxCkv76hY2aaSmfYgGC22CGPujATe9O4PuLmj yS/ySjje1Q6at31nZ2pagsNBBktGA6SlmsQxess6H8nJ+7CgDwuR55fM9VsxxL5lXJIR EwwA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :content-language:accept-language:references:message-id:date :thread-index:thread-topic:subject:cc:to:from :arc-authentication-results; bh=07cVMesurnH8sIrtR6MRk8oYFjV9VEFW3LgT8acVtdc=; b=mSD9B8xuueRLthvWebSe8Y2xfzVrnW5mQ6tkl8haTdh8dlqdlPeC+71+dpyLaZ8APz IqloCyuo186Uv27CoMSR2dyD1PKgQ81SMWD5ESPD9MGD5ljaLWnGrdfuV0136tCOkmQc RJlY3vyqKkXB47m8M61/dG62Mi46SFBmggQLYGt048ZRquloXCvRxFGHgPEVNiFTlCx+ ZwiP6LM5FMEMPgyeDpUlxWlTW4tCpXfudBu9tDWMbXwWPjSioc1QurYIOb5LBQGv0U2p kVTaqvUpCBEsmAJ7rUTpSbWMdmM02nf229XxgtEo/1cgrO0FgxelmFEZoIbPiVgb3BTu ddvw== ARC-Authentication-Results: i=1; mx.google.com; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=synopsys.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t4si10526000plo.470.2017.11.06.01.32.20; Mon, 06 Nov 2017 01:32:34 -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; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=synopsys.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752523AbdKFJag convert rfc822-to-8bit (ORCPT + 98 others); Mon, 6 Nov 2017 04:30:36 -0500 Received: from us01smtprelay-2.synopsys.com ([198.182.47.9]:50789 "EHLO smtprelay.synopsys.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751850AbdKFJab (ORCPT ); Mon, 6 Nov 2017 04:30:31 -0500 Received: from mailhost.synopsys.com (mailhost3.synopsys.com [10.12.238.238]) by smtprelay.synopsys.com (Postfix) with ESMTP id AACCD24E214A; Mon, 6 Nov 2017 01:30:30 -0800 (PST) Received: from mailhost.synopsys.com (localhost [127.0.0.1]) by mailhost.synopsys.com (Postfix) with ESMTP id 17BFEC95; Mon, 6 Nov 2017 01:30:29 -0800 (PST) Received: from US01WXQAHTC1.internal.synopsys.com (us01wxqahtc1.internal.synopsys.com [10.12.238.230]) by mailhost.synopsys.com (Postfix) with ESMTP id E5773C61; Mon, 6 Nov 2017 01:30:26 -0800 (PST) Received: from AM04WEHTCB.internal.synopsys.com (10.116.16.192) by US01WXQAHTC1.internal.synopsys.com (10.12.238.230) with Microsoft SMTP Server (TLS) id 14.3.266.1; Mon, 6 Nov 2017 01:28:10 -0800 Received: from AM04WEMBXA.internal.synopsys.com ([fe80::79c3:55f2:1f20:5bf4]) by am04wehtcb.internal.synopsys.com ([::1]) with mapi id 14.03.0266.001; Mon, 6 Nov 2017 13:28:07 +0400 From: Minas Harutyunyan To: William Wu , "John.Youn@synopsys.com" , "balbi@kernel.org" , "gregkh@linuxfoundation.org" CC: "heiko@sntech.de" , "linux-kernel@vger.kernel.org" , "linux-usb@vger.kernel.org" , "linux-rockchip@lists.infradead.org" , "frank.wang@rock-chips.com" , "huangtao@rock-chips.com" , "dianders@google.com" , "daniel.meng@rock-chips.com" , "fml@rock-chips.com" Subject: Re: [PATCH] usb: dwc2: host: fix isoc urb actual length Thread-Topic: [PATCH] usb: dwc2: host: fix isoc urb actual length Thread-Index: AQHTVtu+Eo3Q7iuGGUWWpNtXqQP+xQ== Date: Mon, 6 Nov 2017 09:28:07 +0000 Message-ID: <410670D7E743164D87FA6160E7907A560113A39F61@am04wembxa.internal.synopsys.com> References: <1509957939-31786-1-git-send-email-william.wu@rock-chips.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.116.70.92] Content-Type: text/plain; charset="iso-2022-jp" Content-Transfer-Encoding: 8BIT MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, On 11/6/2017 12:46 PM, William Wu wrote: > The actual_length in dwc2_hcd_urb structure is used > to indicate the total data length transferred so far, > but in dwc2_update_isoc_urb_state(), it just updates > the actual_length of isoc frame, and don't update the > urb actual_length at the same time, this will cause > device drivers working error which depend on the urb > actual_length. > > we can easily find this issue if use an USB camera, > the userspace use libusb to get USB data from kernel > via devio driver.In usb devio driver, processcompl() > function will process urb complete and copy data to > userspace depending on urb actual_length. > > Let's update the urb actual_length if the isoc frame > is valid. > > Signed-off-by: William Wu > --- > drivers/usb/dwc2/hcd_intr.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/drivers/usb/dwc2/hcd_intr.c b/drivers/usb/dwc2/hcd_intr.c > index 28a8210..01b1e13 100644 > --- a/drivers/usb/dwc2/hcd_intr.c > +++ b/drivers/usb/dwc2/hcd_intr.c > @@ -580,6 +580,7 @@ static enum dwc2_halt_status dwc2_update_isoc_urb_state( > frame_desc->status = 0; > frame_desc->actual_length = dwc2_get_actual_xfer_length(hsotg, > chan, chnum, qtd, halt_status, NULL); > + urb->actual_length += frame_desc->actual_length; > break; > case DWC2_HC_XFER_FRAME_OVERRUN: > urb->error_count++; > @@ -599,6 +600,7 @@ static enum dwc2_halt_status dwc2_update_isoc_urb_state( > frame_desc->status = -EPROTO; > frame_desc->actual_length = dwc2_get_actual_xfer_length(hsotg, > chan, chnum, qtd, halt_status, NULL); > + urb->actual_length += frame_desc->actual_length; > > /* Skip whole frame */ > if (chan->qh->do_split && > According urb description in usb.h urb->actual_length used for non-iso transfers: "@actual_length: This is read in non-iso completion functions, and ... * ISO transfer status is reported in the status and actual_length fields * of the iso_frame_desc array, ...." Thanks, Minas From 1583305738476220776@xxx Mon Nov 06 08:46:57 +0000 2017 X-GM-THRID: 1583305738476220776 X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread