Received: by 2002:a05:6a10:eb17:0:0:0:0 with SMTP id hx23csp504740pxb; Thu, 9 Sep 2021 06:03:35 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyp17APzJfkEQ5GEtfQ6kcg796sCQo+9COprXe6Y7Ef/PULwp3JEOJsgmcshtg+YtxErvR5 X-Received: by 2002:a05:6638:1393:: with SMTP id w19mr2789305jad.86.1631192614945; Thu, 09 Sep 2021 06:03:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631192614; cv=none; d=google.com; s=arc-20160816; b=ucUhXYV9wol38wtE06jxAF4YA1+2P581PXNn0eWSeREQ29KgW7neCSAwe2NR9j5l0h 9eSp3089KvUNaYF4YG/ZLQZICAWofuCqxmNNuMnPLiv2D15Mp2wzaPfs93zsiAxzxPWj QDJTUc3+zbaeBifP2n/rMl5L4TBqKqZwlFpTF2ENGOot4ajGMKorkuOtG857+QMmDaUz JLZX8sUixTyxqRBaip4GjuCvh8ce9zZgCPsmHlEvQO7CJdkCqDFV7fC6cBcGQE8Z3ejL R12OiqebSOch6GYHauDsbTQMO1+DtZtOY3S809oYzrRsLDENf03dH0Rbh0FTPpo5UsoA N+vg== 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=dsZLboFwDkAbfRSUXlZdsj1O5RsVA89/fpth4cAV+Zo=; b=C5tTfJQYsPfMcWUJVn6hqiowG/2aYrrD0NLm/AetHgjmuPutpxMGvdSZXwT/8fBfIc Wwts6jD91AlPAyf0LeUtjbT5sro8M3YG8U9GM5i2+OBRTvhvctoT27c91SoOn+9h9ysP qnVlaSzH19p761OoYpS/ubsvqAv383uXXv0sl9X7u/wR7uWpe+O4yxkjYnKSkQLmibY7 OsJ9MiLJj1tGHHTpOU/aSt8JyFBKaF0FwtEZtdG3P8knLWVtR364Ed6gA31JsyBTyASP icdNBP3TUQo5dCr7Fz+NrDaVb9o4AJlu/7lLqGENEMlAuXMJ1szDJe0owQnmldYmeUjU ePBA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=JC7roWMK; 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 b16si1529783ila.182.2021.09.09.06.03.15; Thu, 09 Sep 2021 06:03:34 -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=JC7roWMK; 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 S1353853AbhIINCB (ORCPT + 99 others); Thu, 9 Sep 2021 09:02:01 -0400 Received: from mail.kernel.org ([198.145.29.99]:40918 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1354469AbhIIMvK (ORCPT ); Thu, 9 Sep 2021 08:51:10 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 58D9E613A2; Thu, 9 Sep 2021 11:57:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1631188629; bh=Pq+FWwKvLvXcJmC6zHClG84ExKNJqUV4WG9CYNPkQvA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JC7roWMK+U8Jd0hQnKsGdhAiHEVoi/7h6aQDzy7hwELSDPXO0k1wRx6CQ508GV6qq GQ8zvLZr57zE0eBMSNN5gZpompfwN0dEPaF5+oyoayJuz0kWo+fCnOJrKnHsukrjXa 57E3ISo0ksO+eIVoIYbqaKQLkZcIoA6PsERlLv+6BsxjMytLGdtg0mzzYsuw8HgV8q pKGaO0WtK+qDwGGJeOn/sIRMZlJnwNgeDtI4Z6VbQhIXwXdGRP5sVwJogTNOYrc7/S 6SYsVhFp9UjsK73cKRMG4a7kyNHPQ1HeT1yLE9JDmjiiWny4w9vR14m/zrkVyUuVem k9zZr1hDqaPvg== 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.4 096/109] usbip:vhci_hcd USB port can get stuck in the disabled state Date: Thu, 9 Sep 2021 07:54:53 -0400 Message-Id: <20210909115507.147917-96-sashal@kernel.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210909115507.147917-1-sashal@kernel.org> References: <20210909115507.147917-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 46a46cde2070..170abb06a8a4 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