🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #26346

[PATCH v5 31/33] USB: Retain the result of configuration requests

#26346
From: Leon Romanovsky
Date: Thu, 03 Dec 2026 12:03
78 lines
10835 bytes
From: Leon Romanovsky <leonro@nvidia.com>

The generic USB device driver can bind successfully even when setting its
configuration fails. Authorization that attaches this driver therefore
cannot use the attachment result to report configuration errors or decide
whether setup can be retried.

Retain the last configuration result for callers holding the device lock.
Keep driver binding successful so userspace can recover by selecting
another configuration.

Signed-off-by: Leon Romanovsky <leonro@nvidia.com>
---
 drivers/usb/core/message.c | 12 +++++++++++-
 include/linux/usb.h        |  2 ++
 2 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/core/message.c b/drivers/usb/core/message.c
index ca6976e266f0..32014605b6db 100644
--- a/drivers/usb/core/message.c
+++ b/drivers/usb/core/message.c
@@ -2042,6 +2042,8 @@ static bool usb_has_claimant(struct usb_device *dev,
 	return false;
 }
 
+static int usb_set_configuration_internal(struct usb_device *dev, int configuration);
+
 /*
  * usb_set_configuration - Makes a particular device setting be current
  * @dev: the device whose configuration is being updated
@@ -2089,6 +2091,15 @@ static bool usb_has_claimant(struct usb_device *dev,
  * drivers currently known to the kernel.
  */
 int usb_set_configuration(struct usb_device *dev, int configuration)
+{
+	int ret = usb_set_configuration_internal(dev, configuration);
+
+	dev->config_error = ret;
+	return ret;
+}
+EXPORT_SYMBOL_GPL(usb_set_configuration);
+
+static int usb_set_configuration_internal(struct usb_device *dev, int configuration)
 {
 	int i, ret;
 	struct usb_host_config *cp = NULL;
@@ -2347,7 +2358,6 @@ int usb_set_configuration(struct usb_device *dev, int configuration)
 	usb_autosuspend_device(dev);
 	return 0;
 }
-EXPORT_SYMBOL_GPL(usb_set_configuration);
 
 static LIST_HEAD(set_config_list);
 static DEFINE_SPINLOCK(set_config_lock);
diff --git a/include/linux/usb.h b/include/linux/usb.h
index a5e706f67f33..d372712eba34 100644
--- a/include/linux/usb.h
+++ b/include/linux/usb.h
@@ -599,6 +599,7 @@ struct usb3_lpm_parameters {
  * @descriptor: USB device descriptor
  * @bos: USB device BOS descriptor set
  * @config: all of the device's configs
+ * @config_error: Result of the last configuration request.
  * @actconfig: the active configuration
  * @ep_in: array of IN endpoints
  * @ep_out: array of OUT endpoints
@@ -686,6 +687,7 @@ struct usb_device {
 	struct usb_host_config *config;
 
 	struct usb_host_config *actconfig;
+	int config_error;
 	struct usb_host_endpoint *ep_in[16];
 	struct usb_host_endpoint *ep_out[16];
 

-- 
2.56.1
Technical Details
Message-ID: <20261203-device-trust-core-v5-31-485cc6eddd46@nvidia.com>
Path: mbox-mo1.pugleaf.net!srl.newsdeef.eu.MISMATCH!feed-eu-txt.newsdeef.eu!feed-eu-ch.newsdeef.eu!srl.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-376569-linux-kernel-netdev=dewy.ru
References: <20261203-device-trust-core-v5-0-485cc6eddd46@nvidia.com>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srl.newsdeef.eu.MISMATCH!feed-eu-txt.newsdeef.eu!feed-eu-ch.newsdeef.eu!srl.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-376569-linux-kernel-netdev=dewy.ru
From: leon@kernel.org (Leon Romanovsky)
Newsgroups: linux.kernel.netdev
Subject: [PATCH v5 31/33] USB: Retain the result of configuration requests
Date: Thu,  3 Dec 2026 14:03:53 +0200
Organization: Usenet Network
Message-ID: <20261203-device-trust-core-v5-31-485cc6eddd46@nvidia.com>
References: <20261203-device-trust-core-v5-0-485cc6eddd46@nvidia.com>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="2482782"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:GIS3TVTvu9z/LKTzHHxw7oyWxkc= sha256:FfmjbVnmosrQZJ/gVAuSMGu6SCUutsVVzj8EfIiY+UI=
	sha1:8CGmMgdZK1YLdXnPvTlbosaqh3A= sha256:HHtrQvFxuDjwjfPuVuwikWrXnaMgCIiQdwLpYwG9Rb8=
List-ID: <netdev.vger.kernel.org>
X-Mailpost-Empty-Hdrs: X-Spam-Level
X-Received: from localhost (localhost [127.0.0.1])
	by mail.dewy.ru (Postfix) with ESMTP id BB05B117922; Thu,  3 Dec 2026 15:11:18 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -2.64
X-Spam-Status: No, score=-2.64 tagged_above=-9999 required=6.31
	tests=[DCC_CHECK=1.1, DKIMWL_WL_HIGH=-0.24, DKIM_SIGNED=0.1,
	DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,
	MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001,
	SPF_PASS=-0.001] autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key)
	header.d=kernel.org
X-Received: from mail.dewy.ru ([127.0.0.1])
	by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024)
	with ESMTP id 0OIx6_esuoBy;
	Thu,  3 Dec 2026 15:11:16 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=netdev+bounces-376569-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=pass (p=quarantine dis=none) header.from=kernel.org
X-Received: from tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114])
	by mail.dewy.ru (Postfix) with ESMTPS id 7BBC6117920; Thu,  3 Dec 2026 15:11:08 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by tor.lore.kernel.org (Postfix) with ESMTP id 1743829DA2; Thu,  3 Dec 2026 12:10:40 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass;
	t=1796299548;
	b=mgbOf7h9tP92RoIItqKOFKTmjLTJpYXr2kxws4nbiga0C/qoNQlRbswVgm+jkuh/Zncs
	 J+9up++Y8Q1XlIgUVKAIKTmF+zggpdrdC8Vjo22H23oy2VE5kfxSO6eVwDi/yiLzVxtnb
	 vqqWcPqdnLY16STzgKBjzAugGqGf9gejWOAme3H4JN8Cl+tXSSTB3lHBFSDe/HAEVxLaw
	 NOWoBxtJpFpFp+lD6ZH5dpjlDWvf0D/VkXTdhHUgsr39ByegIcwVEQmyjqhU5OMHl/aQC
	 ToCT5rOZFE/a4rAmsbcMecBz6wm9Xzla24G8rXFFml454Gia+/XdBjcVXGm6u0aRAcQ==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1796299548;
	h=X-Original-To:Received:Received:DKIM-Signature:From:To:Cc:Subject:
	 Date:Message-ID:X-Mailer:In-Reply-To:References:X-Mailing-List:
	 List-Id:List-Post:List-Help:List-Subscribe:List-Unsubscribe:
	 List-Owner:Precedence:MIME-Version:Content-Type:X-Mailer:
	 Content-Transfer-Encoding;
	bh=ISeO2i+GuZYiGOHJvENoifJgXvyueZxJdEJtuPBLslM=;
	b=fuGv4N9lBeizYeflj1dvIggAOuZy3X5BpPB5N/i78XPVcKO8PO8qjp4z5uEFi+TNHwIq
	 GCladVR+Gjqlj+SV/8mAGiGm85/6+qNYmNRNtH4oIOUP8koLBQGwqaQ0wWGdlPahU0Ste
	 vuylxAfstqPUXQ03yojkCGv3PNYDP3t0LJlyiduoyr3xu/aPVC0bHfXJu9JGcl9WuTmKb
	 0/sbvLL1lSCoBmVWMWjqJoUUQh/Q6lrp7NpHZLGWiF8+Npb9iPDHvTMw5taiD03CQxD93
	 7NCd+6uvN/5p+IIrjWekREhAqkgh4b05eZF3wXKfGUMgtarseXQlyf76mKJGbkkdsIA==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; 
	dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b="h/SbQSO1";
	arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-Received: from localhost.localdomain (localhost [127.0.0.1])
	by smtp.subspace.kernel.org (Postfix) with ESMTP id C3C04607BD16;
	Thu,  3 Dec 2026 12:05:48 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=h/SbQSO1
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1796299547;
	b=GaTPlUw9NUvcgzSOcFtGf6cyRp7KQzx2JH3BNAQemBgPwT7ILjdWmZpXIU/n8FFLLeb1
	 0Cu12jTeF1NAOpxE1vTlrEiXIO8+Cde1rz9FeeaD7J5L5n7DCHTTFmeq55xhuAp80jScm
	 0V2p+Btlf1E01WQBUO9qEM6ycXrRxZhW5PaUcU8waKWiqGo4HoRDtTiTkOGXtCmwL2HAB
	 jSJ0c2NFR7XaROmKLSa6iGX4hLnl1WqHa1vQP5BJ8Hf99477G8VBGMm8jRe2KtmhDvsMp
	 o2y/XP6bCCoq8jfHj/2G+mPHTsLyMGlX6x4jqx30cI4t08wMJlM+UL0Q48B5X8xgi2g==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1796299547;
	h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer:
	 In-Reply-To:References:MIME-Version:Content-Type:X-Mailer:
	 Content-Transfer-Encoding;
	bh=ISeO2i+GuZYiGOHJvENoifJgXvyueZxJdEJtuPBLslM=;
	b=AZafyQlDqNxh8oJXPnMfoBRVhPtx1g4iEe4l9/hraLjnBycvp2+6Q6w8swwCa1fRpbM/
	 bdgDx/qwZzTYO63ovNvoCv1pPc1wKdeQAq86uCjEDCEncqBAGG4MTpYYlOV7EDA9Ey6QD
	 O4J6oXOdUku9FCIlVnjM+7pHvBk8PESvhxTvDi+8XRKJlnWlkqe96gZFE1+kbAuoXgLt0
	 Me9TMKyABOq2Q+6Cle33fnfVRsjizAFfNEZTZtgbFSUY6P5WYjnWJvmC4C//Q+MYoSEv1
	 WQCmq7qdqlMOGJGaqMxAdB7UFnTea5cFcrZiL2X0Pt424PlYkkGvCMrVh0e1XUziItA==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; 
	dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b="h/SbQSO1";
	arc=none smtp.remote-ip=100.103.45.18
X-Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature ECDSA (prime256v1))
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id DAA42606CE2E;
	Thu,  3 Dec 2026 12:05:47 +0000 (UTC)
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7B1DF1F00893;
	Thu,  3 Dec 2026 12:05:46 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org;
	s=k20260515; t=1796299547;
	bh=ISeO2i+GuZYiGOHJvENoifJgXvyueZxJdEJtuPBLslM=;
	h=From:To:Cc:Subject:Date:In-Reply-To:References;
	b=h/SbQSO1wKUWSm+EdHN3W+iiluf/szv3t9vtQK5cIMIGZK0o9lnRrWOMj+Z4orjdH
	 UlEUcnkcpfQyB6a+pXMEH6+XhcELE0/tJ+6UwTAltMtS81aw49zgRhPYVgOy8rIKig
	 Qiu703v79Bs2WUXgdTbR4U5bhToIz7fUbUtpyFtOw/gnl1uK4xWowGfBCUVkO+8gKn
	 pI7e+zGDZeaCabq2p2jGBJxZYizOhdLPmku186sQQKme2Enz30oIYwD5sf3Muh+Ru5
	 iDvWuBsl1xno6MBAnPgfxurOu6TxHMQmIUe5ZiyWBSRqRpQm/G4MZOOzclA1+KFmQm
	 ElWP2WVT+SXlg==
X-Cc: linux-kernel@vger.kernel.org,
	driver-core@lists.linux.dev,
	linux-input@vger.kernel.org,
	netdev@vger.kernel.org,
	linux-wireless@vger.kernel.org,
	linux-usb@vger.kernel.org,
	linux-bluetooth@vger.kernel.org,
	linux-acpi@vger.kernel.org,
	linux-doc@vger.kernel.org,
	linux-pci@vger.kernel.org,
	iommu@lists.linux.dev,
	linux-coco@lists.linux.dev,
	Alexey Kardashevskiy <aik@amd.com>,
	Luiz Augusto von Dentz <luiz.von.dentz@intel.com>,
	Greg Kroah-Hartman <gregkh@suse.de>,
	linux-sound@vger.kernel.org,
	Jason Gunthorpe <jgg@ziepe.ca>
X-Mailer: git-send-email 2.56.1
X-In-Reply-To: <20261203-device-trust-core-v5-0-485cc6eddd46@nvidia.com>
X-Mailing-List: netdev@vger.kernel.org
X-List-Post: <mailto:netdev@vger.kernel.org>
X-List-Help: <mailto:netdev+help@vger.kernel.org>
X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org>
X-List-Owner: <mailto:netdev+owner@vger.kernel.org>
X-Precedence: list
X-Mailer: b4 0.17-dev-d2b70