Received: by 2002:a05:6a10:eb17:0:0:0:0 with SMTP id hx23csp464552pxb; Thu, 9 Sep 2021 05:11:27 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxrQeQCCKr5ifKvKkkN4LW+h4sEf3LtSR/StMNJnGZN6mNT1FFa8bH1PtaHl3Giucoc1c9G X-Received: by 2002:a17:906:4f82:: with SMTP id o2mr3165277eju.10.1631189487672; Thu, 09 Sep 2021 05:11:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631189487; cv=none; d=google.com; s=arc-20160816; b=PGGu+j8btb0oyYbIPpJF47k32LrHG3FJeuChUwEX8fegRT1QRqdeq9tD1v8hNpGODF 1iPa6srq+S+h1QhsDWwF7bv8j0D69GSH/TryDSw9sCWSCyteu7u/8GT2iPCBw6beIdOq uq+SM4qVMT3ARWMcVqJbCgL1IkytiRk1aPwlYc7GFqwMp1M/Z6uI9jJmuBrcpTedsnbu Xbus+ep0ZXy9HLZF6lf047XCbJqV3n/+z9BjzbgvsnAECEzA5kCuS51X/5U4/RQPYA+N 1df/iBTusCKDNhbtcZzCLZbOEeLX0MANxlGCr3d8/iyMUisuuV4wKmm3oBBe5tKe3+/1 LHNw== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=dwDMyxfVP196EnQ/qsGvfYiZ90aOoEr4bMbfcdsZmx0=; b=VyxLIZAEn+ks9obbtugjyMZ+4VjrYFtlX+IvacSABZniqumueFyAbUVAhEporBrMf7 Itcg8yHRSj6i/xItVM53We7XpUa8XlayXwlB3p3aZRq5kNoFrtOr/N00g0oL6xuI5q9o qQr7HcZXsqdw3O0mXdHoh/KpT6LZ+vJ6hLZbSAVhs0JkwmYC9B1+aaaf8Ms6FpN5cqRc 8b06bedXqgPVT/wJnk1obSFMaZC32OraofEJMmhJxY1FdNRaiQiTAxPm2q5zAQdMhVGQ wMK0iI6pej9p0bbivpinzxx6iQL79VYAAX9/Wxaf1fQ0uZSa4xOArnrP3gIzzbc4eFNu fGoA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=edgx151c; 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=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id de1si1732316edb.447.2021.09.09.05.10.59; Thu, 09 Sep 2021 05:11:27 -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=@kernel.org header.s=k20201202 header.b=edgx151c; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242814AbhIIMKg (ORCPT + 99 others); Thu, 9 Sep 2021 08:10:36 -0400 Received: from mail.kernel.org ([198.145.29.99]:34892 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245279AbhIIL67 (ORCPT ); Thu, 9 Sep 2021 07:58:59 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 7E80A61212; Thu, 9 Sep 2021 11:45:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1631187951; bh=ipq2xZ7CFfhWJwJIgNAoPCVmyXRWSBM7cc6PGH9Baig=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=edgx151crbwYLxRTgUBJxknBU5B9Bz+j3UuSZkrJzgcvGphMf3b1NkSddz6DNa1Ob iG7o2iy7yM/oLza25JjJufbR9cfROZApdx75qx6743BNSN71tdO5GAhdLH9NyaGq5X CFdWXU0cWq+378Wu0dCIz9Pbh2cEyg1OTf96V6VHgEQx+WKYCQQqYh3ARFwkd6jsQL P464FOSRQrsnjVTw7LrbppsrEfqacLytNqESv7/HT6s9qHQH9KW39+Hy+wGqSXc0/m RYVuhjEv8lB9XkT25B8ErStKXi8ZLwBzh67YqJu1gbxgVJB/evVptOjygaIwngcFwW X4l3Sz8NtQyLw== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Shuah Khan , Michael , Greg Kroah-Hartman , Sasha Levin , linux-usb@vger.kernel.org Subject: [PATCH AUTOSEL 5.14 219/252] usbip:vhci_hcd USB port can get stuck in the disabled state Date: Thu, 9 Sep 2021 07:40:33 -0400 Message-Id: <20210909114106.141462-219-sashal@kernel.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210909114106.141462-1-sashal@kernel.org> References: <20210909114106.141462-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore 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