🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #26318

[PATCH v5 06/33] USB: Reject usbfs connect requests for unregistered interfaces

#26318
From: Leon Romanovsky
Date: Thu, 03 Dec 2026 12:03
47 lines
9748 bytes
From: Leon Romanovsky <leonro@nvidia.com>

USB core does not register DT-disabled interfaces, and an interface whose
registration failed stays in the active configuration. USBDEVFS_CONNECT
still asks driver core to attach a driver to such an interface:

proc_ioctl()
  device_attach()
    __device_attach()

The interface has no driver-core private data, so the request
dereferences a NULL pointer.

Return -ENODEV for an unregistered interface. An interface claimed by a
sibling driver keeps reporting -EBUSY.

Fixes: ef0ff68351be ("driver core: Probe devices asynchronously instead of the driver")
Fixes: 654888327e9f ("driver core: Avoid binding drivers to dead devices")
Signed-off-by: Leon Romanovsky <leonro@nvidia.com>
---
 drivers/usb/core/devio.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/usb/core/devio.c b/drivers/usb/core/devio.c
index 101cb9425480..1491ba015bcd 100644
--- a/drivers/usb/core/devio.c
+++ b/drivers/usb/core/devio.c
@@ -2366,10 +2366,12 @@ static int proc_ioctl(struct usb_dev_state *ps, struct usbdevfs_ioctl *ctl)
 
 	/* let kernel drivers try to (re)bind to the interface */
 	case USBDEVFS_CONNECT:
-		if (!intf->dev.driver)
-			retval = device_attach(&intf->dev);
-		else
+		if (intf->dev.driver)
 			retval = -EBUSY;
+		else if (!device_is_registered(&intf->dev))
+			retval = -ENODEV;
+		else
+			retval = device_attach(&intf->dev);
 		break;
 
 	/* talk directly to the interface's driver */

-- 
2.56.1
Technical Details
Message-ID: <20261203-device-trust-core-v5-6-485cc6eddd46@nvidia.com>
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu.MISMATCH!feed-us-txt.newsdeef.eu!feed-us-ny.newsdeef.eu!srv.newsdeef.eu!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-376540-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!srv.newsdeef.eu.MISMATCH!feed-us-txt.newsdeef.eu!feed-us-ny.newsdeef.eu!srv.newsdeef.eu!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-376540-linux-kernel-netdev=dewy.ru
From: leon@kernel.org (Leon Romanovsky)
Newsgroups: linux.kernel.netdev
Subject: [PATCH v5 06/33] USB: Reject usbfs connect requests for unregistered interfaces
Date: Thu,  3 Dec 2026 14:03:28 +0200
Organization: Usenet Network
Message-ID: <20261203-device-trust-core-v5-6-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="2479899"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:4zEili0Ay1ASHi22rmwmmq6QX70= sha256:R/+gzOhdbuLQZW3VQkpZZcoykookp/mEJ0rqzyfyZzI=
	sha1:bi4FsN1xRDRA75J4pGEwUaXnjb4= sha256:yLBMU/pCBdv0rby0C9mTdAfFhYxkJXrU9J5fiChT+JI=
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 B2779117906; Thu,  3 Dec 2026 15:05:27 +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 0RX2cLn_uDpN;
	Thu,  3 Dec 2026 15:05:25 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.232.135.74; helo=sto.lore.kernel.org; envelope-from=netdev+bounces-376540-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 sto.lore.kernel.org (sto.lore.kernel.org [172.232.135.74])
	by mail.dewy.ru (Postfix) with ESMTPS id 85DFF1178B4; Thu,  3 Dec 2026 15:05:17 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by sto.lore.kernel.org (Postfix) with ESMTP id CADEE603911; Thu,  3 Dec 2026 12:05:16 +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=1796299465;
	b=EQ8tGxazXUv5mY1eBNbOfLRiYix5GGGmMRpZvHPYliWoaRuOkr9PO143jS4ti/r0PtiG
	 Rehg02F0PeRVc4LjCF0rQcy6bCTZoG2+aDS9hbJxpUXB980Qt9D6L7CRlYLRSVvh2fKwL
	 v9ef7owB61g3fth5pC8ow215JJn6IBJnt3L6GkaNv2Dk2lVI5XVrEHn5ukES7E4W6d8hQ
	 5EQsVqkdF2ggqVw+6l77poEcCsVyM59BZl5OU67AQTzzeaCiwiBb7q/EfHhFzMeCtZt3D
	 G5Sv5wqRKzdLH9XHV9kBQ80GOW9olHM1XeoaFT2fgT9z/AT3brJcmYFMUTpzDVgFO/w==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1796299465;
	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=K3M3pYvTEMMehCkE0Ic8gyOwhu5oLFPO11od9rZ1Ovo=;
	b=VteGfj6g2lUR6NW4ZXMA0In1m6G1tJFQDWhDPNthZIE8Wg9nFv3BCpM43gWEAc5NLLFg
	 ZYPeDUzu7E7/v059TMMWbLU7SNBdFcJ7ssEOvuviFxfN+niDZBJdhAroFDM4yPIqnsSrb
	 AgpBibJxYXPOZi+xcdxbGZ6n69tGqUVe6o0NqC7bk4Ya4NNpnScovrsGmigdhMq9OM52g
	 cF7I6GHZVPFDq5soCZu0oeGklkJsWg8D51mMOfpJcLtEmDdxRdvxb7STLYG8U1SKzui6U
	 ALcQugwd8m2JxjMMppwIXY4AZME8Hkh6QvXm5VYJck99KgYrgQIoXxd5ZZqiNBGx6Xw==
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=gjyNaiho;
	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 11A4360A6F47;
	Thu,  3 Dec 2026 12:04:25 +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=gjyNaiho
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=1796299459;
	b=Uvqo1Frc3Skoj50SHkxMf4IW1kZxH0+vLJtjhQMC9/xb03wR6j8LX+bvX5SPh3GnjSQ4
	 cnsa1Ie6q/pSmZWrsiQCdNjBTa/O3fakg1kGvcs5+6JF17Yog40iYArt1RYeZ8Engygke
	 zzDRYUx0+yTf4YdEJR5ybGgJJbLIl8wg/ivK7HyUsInkpuLla/sqw2NTQY2AYRd8DVEPe
	 GyaUkYdr2Tc/RMJBbdDsvRSRqu/ngl9zrR+NduEWuDHssCCaorA4LTcBtrJCekQdoDVtD
	 t2HnpFTxe6mZMJgZmqjL8ler3NI406X4S2RxCQrr1peZouokoT8yCqL2YuC1GHo6I9Q==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1796299459;
	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=K3M3pYvTEMMehCkE0Ic8gyOwhu5oLFPO11od9rZ1Ovo=;
	b=f4b6tKr7Y2NgbViEUYfh+/dRm7iIPoldH65OpMaSj6DYKoee0Cmq3oG61aYzklDFurCP
	 /qcxGvKtVQzGgrmKe2LESZlJNElKzdolBQZo/KHqwJJXLA103KIKpoHrHDXmKAK7C/WT0
	 xO6RJ9q4ERThftu1VWNVQbc6+Kyxk3XbnR2J21Uqzyy4HxAwqXZICLUbNJ4ouJZ2wOax+
	 9ixYs1b9pITp5vrGjltp9+U0UiwMIW8TKTdVnT2rZAiNGeq2mWb9pBfUux7Thb87DxRu5
	 ++Iph9MPq05LFPYL3pLowBRK7/u1uxDHwIrU2gsm2rDITuKuf0loCrm2dUufhLAbgog==
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=gjyNaiho;
	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 2CBC0606A683;
	Thu,  3 Dec 2026 12:04:18 +0000 (UTC)
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0EE911F00925;
	Thu,  3 Dec 2026 12:04:18 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org;
	s=k20260515; t=1796299458;
	bh=K3M3pYvTEMMehCkE0Ic8gyOwhu5oLFPO11od9rZ1Ovo=;
	h=From:To:Cc:Subject:Date:In-Reply-To:References;
	b=gjyNaihokgZTpn9SVDGXgk7NsLzhs917R1cFOa6Znp7kLegL1brIAJJWK+vZLjv/1
	 A9ikQyA90cu6syWFMzxANFMr4T//KLWjB1vUJwnYZC1ygWxmWRgZCPpJoraHzmt53K
	 HmpuInyZfoeekjHaxkw/1ZN4Hu1YxAZsJZJnxyaIknaLXlQLB9ZWPxJnuMX6h+Sy3w
	 zoL2mPiV0c73DmW9MbC1atRFZN4joE2bv1j4NjwUkXxB1WPs6tyYujxwZy/h1n78oI
	 /tvLHhrE3Hyye0JSiRPj33bXBrXpnASeiNfx5l465FI57pwJhq9HA0X8Iol5sMNjNB
	 m33lfdxrBXNPQ==
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