Article View: linux.kernel.netdev
Article #21673[PATCH v4 31/33] USB: Retain the result of configuration requests
From: Leon Romanovsky
Date: Tue, 24 Nov 2026 09:44
Date: Tue, 24 Nov 2026 09:44
78 lines
10773 bytes
10773 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 ca6976e266f02..32014605b6db6 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 a5e706f67f33a..d372712eba34c 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:
<20261124-device-trust-core-v4-31-037eb0d17b1f@nvidia.com>Path:
mbox-mo1.pugleaf.net!srv.newsdeef.eu!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-370194-linux-kernel-netdev=dewy.ruReferences:
<20261124-device-trust-core-v4-0-037eb0d17b1f@nvidia.com>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-370194-linux-kernel-netdev=dewy.ru From: leon@kernel.org (Leon Romanovsky) Newsgroups: linux.kernel.netdev Subject: [PATCH v4 31/33] USB: Retain the result of configuration requests Date: Tue, 24 Nov 2026 11:44:02 +0200 Organization: Usenet Network Message-ID: <20261124-device-trust-core-v4-31-037eb0d17b1f@nvidia.com> References: <20261124-device-trust-core-v4-0-037eb0d17b1f@nvidia.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Injection-Info: usenet.network; logging-data="4105382"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:wSBIb9U8kM44z/f2ghtMHGRKrOk= sha256:EJDtkQV7y8QgjNSzTjT0vMhAIzaQsG5E2lHkYn6jRn4= sha1:03ohNW9fgO9irLC4MLrr9iJkWIQ= sha256:fxdR5mGezQ//x7RRz+31y4cgfzfg7OfwjHrbwjd1kiM= 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 DD4FA125DEB; Tue, 24 Nov 2026 12:50:21 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -2.301 X-Spam-Status: No, score=-2.301 tagged_above=-9999 required=6.31 tests=[DCC_CHECK=1.1, DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.001, 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 QYjCFO8eTNsl; Tue, 24 Nov 2026 12:50:18 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=104.64.211.4; helo=sin.lore.kernel.org; envelope-from=netdev+bounces-370194-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 sin.lore.kernel.org (sin.lore.kernel.org [104.64.211.4]) by mail.dewy.ru (Postfix) with ESMTPS id 720A6125DE9; Tue, 24 Nov 2026 12:50:10 +0300 (MSK) X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by sin.lore.kernel.org (Postfix) with ESMTP id 74ABF216D1; Tue, 24 Nov 2026 09:49:59 +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=1795513601; b=K5QE8hVTSEnixYwvzaRFkCvpBC6AxNrA5UsPvApuIwjLjViGwDvx4VnKIJV/BF1lwBDY KgvJPIzpmXwzXzx40sCWU1P3aLkXOX7roif08gUpJZaAFz/oRMiQyJRYOEtbgrgLFqdCE 9NAU6QRLYwMLrCW23qh4/XzUFEy5bIYQRLzD+/c2qcHWsOZqhVcE/LAlNRk/sP1Z4yL9m oZ6Yh0VL5q3oNwke+ydUMoF66PzRU54WkDDTuqIFhAX9Od8aOEbs4w2Zqjz+VmOJM2Fxe SIZagqXxb7RYHWuctCN2StIE8XAT4gRS35MHQVz2h0JBP/DKfr7Dg03Sij+mOM9Zaxw== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795513601; 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=ACH0QP0Df8Q+KvPtc3RDClRqoeZVsyJD6IcERMn9LAQ=; b=dG1pY3FQRFwAR7iFvuGGlWxUHUO08k3929KrO/FpinnLv7WtRTzvL8Z9eDEDR4GEK0li 1xrf3vGjBfxSFz9dtGN0OSyupmdPFEKe+SEOdkdzDS/LnlAAyhqGBg13PczRtNtgR5efo shJ1pMSzGr018VJZ8cRcJFnIAkPMGftmWtDLfrjYBQl6Gt3/Lyv46ai0p6DHejAdU1mI9 5VjERhuQWawt8Y76XATGnd4atmVxkCeOeC7eQ7udD+UEDONh8gBuFB3Fh76aszoUNMbyR F0VgP3C6/00SIISl65GPfELsAPHcbX7XavJoQ9nWnT/3UpkmUn8TTHUHEnz/ni3f81w== 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=IakvQ5Da; 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 31C0D607845D; Tue, 24 Nov 2026 09:46:41 +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=IakvQ5Da 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=1795513585; b=RoooaaOW7Ux+bHTuSKSAxDQXrHZKIU/TF9tZc7G5lhmEEgS3nu55/MkI28IeKK27OZhI jik5Cao2/wG2ZPR7haNoA5hLKGOfb+FGrb4fIanmnBdDaOJlh/6+Mqe+vZhReGHESW50r apw8Qy2OPNlBXyM/8yYp2U4mdBmF6lbm7BgFITf+ds/j97q6aYLulZcwlc6rO+lmi1F17 g2lZvCQBE9onoDhrSeRIQ79voidx/WDKiFtuVRaVpfHVETa/D3+2BaIgt9xm75PrB3zpu h7meU2z/v1K9HwiR8vhGGJ7DPmlxeqkfKIo1rtiyObsgMmvyNAmErDcPUIrtthunryQ== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795513585; 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=ACH0QP0Df8Q+KvPtc3RDClRqoeZVsyJD6IcERMn9LAQ=; b=0/y9/my4mhXn59PKNYMAA6Ci2p8uifnr/Dk7PcTRLL+I1DRBzbTPf6AmpBS6QGYlA+Al 2R1VBdf4WHu5bB67QsJ23OUubmE0xesVANlMu1bwKKTVRew5ki1LepsDVzhjHb+EEOrUp TYIfUIqDnv91F5TuaeH3xqGHWD8WbvigQiBWPwSU20ixaImUEuI9HV5XHqgluztEUcHvA qLwDMuSKmUDZUqNN5aslFurJMb6PMVYcPJMG5eTmLvjp72mbPUmi3DLqw9QBSnNMzBWtv b2kog2y6cQNcMgnRxECNXsBJZ/DBHrm9rLZUqlc0oIoUFoXY8eaZXMDiY4ze75YTwrQ== 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=IakvQ5Da; 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 48DBF606A69E; Tue, 24 Nov 2026 09:46:25 +0000 (UTC) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id D70021F00A3E; Tue, 24 Nov 2026 09:46:23 +0000 (UTC) X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1795513584; bh=ACH0QP0Df8Q+KvPtc3RDClRqoeZVsyJD6IcERMn9LAQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=IakvQ5Da/Gh4K6sBHTyHbfltZXdEyfK98raJEjcwIw6hgnVLjtiXVUQANndVUB++0 eKzgwDXvsEe2ZYcD3HgIOAKVhtIlLHQ2dCXQvTshJ9VKFGMOxYSVkjy2OZcQjiHVvB W7q2S3Ln1PCBesXOj5LO1HpWvbzUxKAFb4frmXkYbMd+fqP7C77iX0amCZdKjmiZaL 9hfjqN6GitLmaLRYOMeRkk3E1QxpqiCNMy7WlVrwU9x4UEqtnsvNlQsT3PgGr1m3zg u3lMdT1PxyF83Q/kCOn+BehOXAZEWC7uhFUWkz4y6sQG9zhtELyGyQxbZBGY3JVGyd Le3SsmYRMgjiA== 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: <20261124-device-trust-core-v4-0-037eb0d17b1f@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.15-dev-18f8f