From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9BEE03DB8F for ; Wed, 15 Nov 2023 20:04:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="BwGfrbMC" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3A734C433C7; Wed, 15 Nov 2023 20:04:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1700078688; bh=ZZSeUUl7EYRvWusZ1xTJqcUdx5yjnn+VT0JLs2zFo7Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BwGfrbMCkMmeXDF9vMUZGI4qW9VoWao9U1mof6Tbwg9jVLHVyWQNzBUHugpxfUFNq 5Jg6U9IuM/ZG/oCHXz6hp0CRN4k7uABPDoHwDwfQYb36XG5dRXVWLMKb90KjCaUYO4 B72dvHPFGA5GTC0KXLJqRKepic1ieFRnMKunj3dI= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Jonas Blixt , Shuah Khan , Sasha Levin Subject: [PATCH 4.14 29/45] USB: usbip: fix stub_dev hub disconnect Date: Wed, 15 Nov 2023 14:33:06 -0500 Message-ID: <20231115191421.335117590@linuxfoundation.org> X-Mailer: git-send-email 2.42.1 In-Reply-To: <20231115191419.641552204@linuxfoundation.org> References: <20231115191419.641552204@linuxfoundation.org> User-Agent: quilt/0.67 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 4.14-stable review patch. If anyone has any objections, please let me know. ------------------ From: Jonas Blixt [ Upstream commit 97475763484245916735a1aa9a3310a01d46b008 ] If a hub is disconnected that has device(s) that's attached to the usbip layer the disconnect function might fail because it tries to release the port on an already disconnected hub. Fixes: 6080cd0e9239 ("staging: usbip: claim ports used by shared devices") Signed-off-by: Jonas Blixt Acked-by: Shuah Khan Link: https://lore.kernel.org/r/20230615092810.1215490-1-jonas.blixt@actia.se Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- drivers/usb/usbip/stub_dev.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/drivers/usb/usbip/stub_dev.c b/drivers/usb/usbip/stub_dev.c index 16bb3197d6580..d179b281b9521 100644 --- a/drivers/usb/usbip/stub_dev.c +++ b/drivers/usb/usbip/stub_dev.c @@ -511,8 +511,13 @@ static void stub_disconnect(struct usb_device *udev) /* release port */ rc = usb_hub_release_port(udev->parent, udev->portnum, (struct usb_dev_state *) udev); - if (rc) { - dev_dbg(&udev->dev, "unable to release port\n"); + /* + * NOTE: If a HUB disconnect triggered disconnect of the down stream + * device usb_hub_release_port will return -ENODEV so we can safely ignore + * that error here. + */ + if (rc && (rc != -ENODEV)) { + dev_dbg(&udev->dev, "unable to release port (%i)\n", rc); return; } -- 2.42.0