Received: by 2002:a05:6a10:eb17:0:0:0:0 with SMTP id hx23csp520389pxb; Thu, 9 Sep 2021 06:20:13 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy7t+baTqU24YfMUX1vBb/I2xejSDre+1+cxvIu5yXe5GBtUFaPxYdrjI+BuQVkGCQ6PefI X-Received: by 2002:a05:6638:1352:: with SMTP id u18mr2838457jad.147.1631193613216; Thu, 09 Sep 2021 06:20:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631193613; cv=none; d=google.com; s=arc-20160816; b=lC4R0icactvPkRhSJU/eKbtuxYRsbvVeRWWoOf8GV6zAkje5jyzCmvyONcMhnRo6S7 7mBIr41IIlw7UduQQiGYvXNTpSfyRfWIuvosvSP9wT0+id+ygXsMgTtO+UhYU0rPPgvd WHADvZhlcIZ139z03zG5imBe75nLMrGIxERCPmn+CUHViHxOL8bnUdvTGvPBX4mPm7CO 61tT8QYU7oUrVRE2r+fvPMedY+J+l3hxhx4u6ntj8tlTLCb0v94yO/p0xwhCbEnZHJUm Hia9AKEKc0NEwaBwGqer+SRFLid4Dl7bWUxAGzXRKBQgKXAptimzixWBwwTT4/6G4JZO KhDQ== 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=8a27unyyH//sIY/UwRauEyqP7sCQAIRwJzmdcVdS0fU=; b=izsCucj5U0XiiiTnsU90/z9TB+N9xvc+Qnn9WNd8hEQ1z+tUttYZ2RrMWRraBTI4Kn F/zjTp0pfxylgj9TWoCZDylFsEcOpEEKhdJzdmqVKkrMTU1e+Sm704d5tMefJSGviVCt y7U1FI78Q4PhTG+E3MSKF6xNtXACOMWPeg36RmTY5MZsx95nHMEe0OOxRORonFssMgh/ DRFLE04AMjcS/LlqcRpQK1L+hp8XLJiv9RSPHeGKG5bhLT8KmmYrhDV2fz8eWPzalagV tDaGQtCLxTRJ5i7mQnTv77TamLQUZjm2lXsTKtB17e2zerBTobbID+ABicuB6Lddtk7M yxxQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="C/LlBrkx"; 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 c1si1754052ilo.83.2021.09.09.06.19.57; Thu, 09 Sep 2021 06:20:13 -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="C/LlBrkx"; 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 S1356243AbhIINSK (ORCPT + 99 others); Thu, 9 Sep 2021 09:18:10 -0400 Received: from mail.kernel.org ([198.145.29.99]:53480 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1357895AbhIINFS (ORCPT ); Thu, 9 Sep 2021 09:05:18 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 1DE9C63288; Thu, 9 Sep 2021 12:00:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1631188806; bh=T91Zgokphle+V0vjmg+UqKidMYlUGT5t5wylyld9/q4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=C/LlBrkxGvi4lus4fRXdE7bK4ZksvepoyW9GF1nXlq73xqiF4pFW6kvi9fLIfMOLN pwbQms9Tz34b/0TrbddeNDkkRtBRUFGIXVw7+CgbDXXTFk7JYAdF+lMwR5PczS+Van Sn4Xx/I0jCtps36dOdZgtbVnJa2xPhbfsnFdQEDABaZJB6Q0qwzJn9euECS8CNncw/ pIQkAi90dFtRVgqTNau4r/MnNhYFtC8QNmU1NUvMYEPc05kTQkg/nPZcZmvYYQGOu2 NqRvhRMrfU5nBhW1CzFDcmXXotNhjmvwk3ch1pFx8H8dAACHL2ji6Z53v6UtDl3O+T TLGCRqj2cKtLw== 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 4.14 52/59] usbip:vhci_hcd USB port can get stuck in the disabled state Date: Thu, 9 Sep 2021 07:58:53 -0400 Message-Id: <20210909115900.149795-52-sashal@kernel.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210909115900.149795-1-sashal@kernel.org> References: <20210909115900.149795-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 709214df2c18..22e8cda7a137 100644 --- a/drivers/usb/usbip/vhci_hcd.c +++ b/drivers/usb/usbip/vhci_hcd.c @@ -469,8 +469,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