From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756613AbdDFI44 (ORCPT ); Thu, 6 Apr 2017 04:56:56 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:53894 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756051AbdDFIqI (ORCPT ); Thu, 6 Apr 2017 04:46:08 -0400 From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mathias Nyman Subject: [PATCH 4.10 56/81] xhci: Set URB actual length for stopped control transfers Date: Thu, 6 Apr 2017 10:38:48 +0200 Message-Id: <20170406083626.592041996@linuxfoundation.org> X-Mailer: git-send-email 2.12.2 In-Reply-To: <20170406083624.322941631@linuxfoundation.org> References: <20170406083624.322941631@linuxfoundation.org> User-Agent: quilt/0.65 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.10-stable review patch. If anyone has any objections, please let me know. ------------------ From: Mathias Nyman commit 0ab2881a406b9fd46224a3e8253bbc0141b4f844 upstream. A control transfer that stopped at the status stage incorrectly warned about a "unexpected TRB Type 4", and did not set the transferred actual_length for the URB. The URB actual_length for control transfers should contain the bytes transferred in the data stage. Bytes of a partially sent setup stage and missing bytes from status stage should be left out. Signed-off-by: Mathias Nyman Signed-off-by: Greg Kroah-Hartman --- drivers/usb/host/xhci-ring.c | 3 +++ 1 file changed, 3 insertions(+) --- a/drivers/usb/host/xhci-ring.c +++ b/drivers/usb/host/xhci-ring.c @@ -2000,6 +2000,9 @@ static int process_ctrl_td(struct xhci_h case TRB_NORMAL: td->urb->actual_length = requested - remaining; goto finish_td; + case TRB_STATUS: + td->urb->actual_length = requested; + goto finish_td; default: xhci_warn(xhci, "WARN: unexpected TRB Type %d\n", trb_type);