Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp2729560pxj; Mon, 31 May 2021 09:16:06 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzvrzKvHq1JHepjtFZ/4PevNjXsyICGTiZ+vyN1Qi+UP+yPwavpXZ5LUnqBQbUWF06TERu8 X-Received: by 2002:a6b:3c06:: with SMTP id k6mr17518973iob.113.1622477765862; Mon, 31 May 2021 09:16:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622477765; cv=none; d=google.com; s=arc-20160816; b=URgRh4ma3q2N5wF9axBdl/JMZzn1+2V0z788AILqXZ8J0AJhna8MJ8mbOP6NGb4O5q fdwdegAY1e/WF2GzFR0sg2kD20Vl8RipYLZD0M+nFY0N7CSrdqd2cr+7NYmqt03EPntS bO5Tm2Op88nsGQSoxWFghDLj2ya2jZokLdBLwP381gXGMTqXb+zfBfJMvunjWwNjWXti LqhVh2JzSsVdmFl14xYUq20WTJxKA6ZzE4Ir53iUGK4+OmRJASJZmCee+E9P60eapDbE Vto0bjpe5VtDC1KnjD3IHvBUp8zqvebdaAEPEg3CvCUEqUneopPhJcawciWDG+LrUoIh 2SVw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=qQMj4cOlKmhLY7Dc6v1LwwtAb8axoY1F4ihHcyp3nIU=; b=fdJiWQTdGUunLYn/z0JaAvM42xBUBYeKE7kWcNj1mMYo/Noj7NtVH8RNCv9ZCkPuDn 6LvRkgnmRTotSWPhnqsqHQjDj2n6y/GAqQ7GIMiiKur4+RXTFI6ALMMuKhLZTx9Ajl9a HZ/OTa0g7ofclz8mCr2gL3z8K6x8WHZ3qIQCORJ+6B4u2zUqnA/yXUjeK+EgPr3Ln6sI 6fldZUNivZBTu39NUlMCB9tkzK7RwFJnUKmjH9HyTezIaZu3TcVyIYrpAzTU+97SLpKt IVlwZ/yMX5lWd+DxsGjOmo0TcRXp2iCLNQ/gZeLDJxyVTNNjDzI/D5VKqUJidyON44dj sSng== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=G9BfRCPI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id n4si13480443ion.59.2021.05.31.09.15.53; Mon, 31 May 2021 09:16:05 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=G9BfRCPI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231783AbhEaQPo (ORCPT + 99 others); Mon, 31 May 2021 12:15:44 -0400 Received: from mail.kernel.org ([198.145.29.99]:38012 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234157AbhEaOjf (ORCPT ); Mon, 31 May 2021 10:39:35 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 6B34261C64; Mon, 31 May 2021 13:52:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1622469163; bh=IIXP4rILIB9WbdcFuN8WG8aqTxMgdHBoZdvAbZ7rP6A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=G9BfRCPIAOQhI+RRsz+ofl86nJNXQIyHJ0r+A8O3ZhXrkjEHczgaQI0G8n5O+WFDi U83jvN+jIpaPbDEkBMjk22WI9e7f+E+ZsQUspwIM26dQKy0jPJJQCGKp9NZ4ZVgnR9 kmckptkX+eYlPSZPrBn/S8SDhVb2mq5jCvxH4ZIU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Peter Ganzhorn , Mathias Nyman Subject: [PATCH 5.12 092/296] xhci: fix giving back URB with incorrect status regression in 5.12 Date: Mon, 31 May 2021 15:12:27 +0200 Message-Id: <20210531130706.991685783@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210531130703.762129381@linuxfoundation.org> References: <20210531130703.762129381@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Mathias Nyman commit a80c203c3f1c06d2201c19ae071d0ae770a2b1ca upstream. 5.12 kernel changes how xhci handles cancelled URBs and halted endpoints. Among these changes cancelled and stalled URBs are no longer given back before they are cleared from xHC hardware cache. These changes unfortunately cleared the -EPIPE status of a stalled transfer in one case before giving bak the URB, causing a USB card reader to fail from working. Fixes: 674f8438c121 ("xhci: split handling halted endpoints into two steps") Cc: # 5.12 Reported-by: Peter Ganzhorn Tested-by: Peter Ganzhorn Signed-off-by: Mathias Nyman Link: https://lore.kernel.org/r/20210525074100.1154090-2-mathias.nyman@linux.intel.com Signed-off-by: Greg Kroah-Hartman --- drivers/usb/host/xhci-ring.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) --- a/drivers/usb/host/xhci-ring.c +++ b/drivers/usb/host/xhci-ring.c @@ -829,14 +829,10 @@ static void xhci_giveback_invalidated_td list_for_each_entry_safe(td, tmp_td, &ep->cancelled_td_list, cancelled_td_list) { - /* - * Doesn't matter what we pass for status, since the core will - * just overwrite it (because the URB has been unlinked). - */ ring = xhci_urb_to_transfer_ring(ep->xhci, td->urb); if (td->cancel_status == TD_CLEARED) - xhci_td_cleanup(ep->xhci, td, ring, 0); + xhci_td_cleanup(ep->xhci, td, ring, td->status); if (ep->xhci->xhc_state & XHCI_STATE_DYING) return;