Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp1570157pxb; Thu, 16 Sep 2021 10:07:04 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx9t7jMmtUgja2nzrGJ4aA2Sm4nvHDN/EATKDaXspEGm/BpjJMu/2QCRYJJ5yB/lvmLwDHu X-Received: by 2002:a17:907:2717:: with SMTP id w23mr7297930ejk.283.1631812023923; Thu, 16 Sep 2021 10:07:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631812023; cv=none; d=google.com; s=arc-20160816; b=F/VZadhxJIVMqrd3bpCpBxjXCyn5c+mN7CRRe9PRcOUtNi63BK//M+EM1djXJlb6iv 2SjhCUbVcbAuuj7DpP46+1cz0eOImKWFRO7ljjtBAHRezVRdlgoqqPDfP3kpN+4GZr4f OL4WxIncEKX33EKJFom51HUOdD5W1puZLY4MzQyeKvZn+S4QO9KfATrPZbJI0RTsXt9+ KB8oVXb1JyjygvyV2IlzcRrU6w92W0E/Ow+CZJUu/fj2bdEZGXBQWwhTP/mETO+O3eNM A/nZNh895d0iJgvSb2QBPsh8U7mkuMMLYdqKixQTkj5Hrts04hT4kwSmSyItN9zvK3NZ O8LA== 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=dwDMyxfVP196EnQ/qsGvfYiZ90aOoEr4bMbfcdsZmx0=; b=EEwmRxjxpSWGpto/5vyV8lH50n4cXGRdDWqfxibXW74yfBNDJwAGATYcfUzWk7kY7A t4cu6Y0WAz1gZNzjRMAMdCiNg9torQEfxTdTng7C3k/96QZaeie1ea+EH+6Cmor379dx 5VRyQZcJ4h85SK99iA6JE7cDEHMyTDqmm92GSgipv7cCwcPE2Ja289EORwZBYgb/SX46 V9r752mnKuBHkFiXwbRuCj97k4FmRZ5Pvu5sUZoMT1iiR5xTIsTGcBh/TQspJIs3gvC/ bi+62cBhH8UYD8O/sQ/X3UNGQLVmKSyqhVfI07K/m8227MoG/m/CXRB/mAORcNc2Azta 9j5w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=wHytFZ7m; 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 r8si3594877edb.185.2021.09.16.10.06.35; Thu, 16 Sep 2021 10:07:03 -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=wHytFZ7m; 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 S1349032AbhIPRFq (ORCPT + 99 others); Thu, 16 Sep 2021 13:05:46 -0400 Received: from mail.kernel.org ([198.145.29.99]:34032 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347889AbhIPRAq (ORCPT ); Thu, 16 Sep 2021 13:00:46 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 93153613A0; Thu, 16 Sep 2021 16:32:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1631809970; bh=ipq2xZ7CFfhWJwJIgNAoPCVmyXRWSBM7cc6PGH9Baig=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wHytFZ7msg8WHxuoAgUWz/aYOKq+9NfGPpDbMPsHz6d2YDq/H5Jc0oauoKYYX+qVg yLBCxVJyK6uaOjpLrSHeS0VI4lvpar9edIutNYF65mDvGrv3jB8MppyIxUT1Cdu7vi QjTCJ8x57yzqrHOXoeq7Swv3lXZl/VJqkgJwKWvU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Michael , Shuah Khan , Sasha Levin Subject: [PATCH 5.13 318/380] usbip:vhci_hcd USB port can get stuck in the disabled state Date: Thu, 16 Sep 2021 18:01:15 +0200 Message-Id: <20210916155814.864500853@linuxfoundation.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210916155803.966362085@linuxfoundation.org> References: <20210916155803.966362085@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: Shuah Khan [ Upstream commit 66cce9e73ec61967ed1f97f30cee79bd9a2bb7ee ] When a remote usb device is attached to the local Virtual USB Host Controller Root Hub port, the bound device driver may send a port reset command. vhci_hcd accepts port resets only when the device doesn't have port address assigned to it. When reset happens device is in assigned/used state and vhci_hcd rejects it leaving the port in a stuck state. This problem was found when a blue-tooth or xbox wireless dongle was passed through using usbip. A few drivers reset the port during probe including mt76 driver specific to this bug report. Fix the problem with a change to honor reset requests when device is in used state (VDEV_ST_USED). Reported-and-tested-by: Michael Suggested-by: Michael Signed-off-by: Shuah Khan Link: https://lore.kernel.org/r/20210819225937.41037-1-skhan@linuxfoundation.org Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- drivers/usb/usbip/vhci_hcd.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/usb/usbip/vhci_hcd.c b/drivers/usb/usbip/vhci_hcd.c index 190bd3d1c1f0..b07b2925ff78 100644 --- a/drivers/usb/usbip/vhci_hcd.c +++ b/drivers/usb/usbip/vhci_hcd.c @@ -455,8 +455,14 @@ static int vhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue, vhci_hcd->port_status[rhport] &= ~(1 << USB_PORT_FEAT_RESET); vhci_hcd->re_timeout = 0; + /* + * A few drivers do usb reset during probe when + * the device could be in VDEV_ST_USED state + */ if (vhci_hcd->vdev[rhport].ud.status == - VDEV_ST_NOTASSIGNED) { + VDEV_ST_NOTASSIGNED || + vhci_hcd->vdev[rhport].ud.status == + VDEV_ST_USED) { usbip_dbg_vhci_rh( " enable rhport %d (status %u)\n", rhport, -- 2.30.2