From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail.linuxfoundation.org ([140.211.169.12]:49704 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752968AbdC0OHZ (ORCPT ); Mon, 27 Mar 2017 10:07:25 -0400 Date: Mon, 27 Mar 2017 16:07:05 +0200 From: Greg KH To: Mathias Nyman Cc: linux-usb@vger.kernel.org, stable@vger.kernel.org Subject: Re: [PATCH 2/3] xhci: Set URB actual length for stopped control transfers Message-ID: <20170327140705.GA30403@kroah.com> References: <1490623120-8435-1-git-send-email-mathias.nyman@linux.intel.com> <1490623120-8435-3-git-send-email-mathias.nyman@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1490623120-8435-3-git-send-email-mathias.nyman@linux.intel.com> Sender: stable-owner@vger.kernel.org List-ID: On Mon, Mar 27, 2017 at 04:58:39PM +0300, Mathias Nyman wrote: > A control transfer that stopped at the status stage incorrectly > warned about a "unexpected TRB Type 4", and did not set the > tranferred actual_length for the URB. > > The tranferred actual_length should be set the same way for > COMP_STOPPED control tranfers as in the generic cases. > > generic case if we get an event at: > > TRB_SETUP stage: > length = 0; > > TRB_DATA/TRB_NORMAL state: > length = requested - remaining; > > TRB_STATUS stage: > length = requested > > The URB actual_length for control transfers doesn't care about sent > bytes of the SETUP stage, or remaining bytes of the STATUS stage. > > Cc: > Signed-off-by: Mathias Nyman > --- > drivers/usb/host/xhci-ring.c | 21 ++++++--------------- > 1 file changed, 6 insertions(+), 15 deletions(-) > > diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c > index d9936c7..0aca4c9 100644 > --- a/drivers/usb/host/xhci-ring.c > +++ b/drivers/usb/host/xhci-ring.c > @@ -1961,6 +1961,7 @@ static int process_ctrl_td(struct xhci_hcd *xhci, struct xhci_td *td, > requested = td->urb->transfer_buffer_length; > remaining = EVENT_TRB_LEN(le32_to_cpu(event->transfer_len)); > > + > switch (trb_comp_code) { > case COMP_SUCCESS: > if (trb_type != TRB_STATUS) { Why the extra blank line? thanks, greg k-h