🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #12215

Re: [PATCH 02/17] Input: serio - attach manual drivers through the driver core

#12215
From: Leon Romanovsky
Date: Fri, 06 Nov 2026 14:33
90 lines
12781 bytes
On Thu, Nov 05, 2026 at 12:34:53PM -0800, Dmitry Torokhov wrote:
> On Thu, Nov 05, 2026 at 09:19:40PM +0200, Leon Romanovsky wrote:
> > On Thu, Nov 05, 2026 at 09:05:29AM -0800, Dmitry Torokhov wrote:
> > > On Thu, Nov 05, 2026 at 01:42:15PM +0200, Leon Romanovsky wrote:
> > > > From: Leon Romanovsky <leonro@nvidia.com>
> > > > 
> > > > Manual serio binding connects a driver before driver core can admit the
> > > > device. A rejected binding therefore arrives after functional setup.
> > > > 
> > > > Keep the port ID check and use device_driver_attach() for the existing bus
> > > > probe path. Driver core then serializes admission and handles probe failure
> > > > before publishing the binding.
> > > > 
> > > > Signed-off-by: Leon Romanovsky <leonro@nvidia.com>
> > > > ---
> > > >  drivers/input/serio/serio.c | 24 +++---------------------
> > > >  1 file changed, 3 insertions(+), 21 deletions(-)
> > > > 
> > > > diff --git a/drivers/input/serio/serio.c b/drivers/input/serio/serio.c
> > > > index 54dd26249b027..604440244c1ca 100644
> > > > --- a/drivers/input/serio/serio.c
> > > > +++ b/drivers/input/serio/serio.c
> > > > @@ -81,28 +81,10 @@ static int serio_match_port(const struct serio_device_id *ids, struct serio *ser
> > > >  
> > > >  static int serio_bind_driver(struct serio *serio, struct serio_driver *drv)
> > > >  {
> > > > -	int error;
> > > > -
> > > > -	if (serio_match_port(drv->id_table, serio)) {
> > > > -
> > > > -		serio->dev.driver = &drv->driver;
> > > > -		if (serio_connect_driver(serio, drv)) {
> > > > -			serio->dev.driver = NULL;
> > > > -			return -ENODEV;
> > > > -		}
> > > > +	if (!serio_match_port(drv->id_table, serio))
> > > > +		return 0;
> > > >  
> > > > -		error = device_bind_driver(&serio->dev);
> > > > -		if (error) {
> > > > -			dev_warn(&serio->dev,
> > > > -				 "device_bind_driver() failed for %s (%s) and %s, error: %d\n",
> > > > -				 serio->phys, serio->name,
> > > > -				 drv->description, error);
> > > > -			serio_disconnect_driver(serio);
> > > > -			serio->dev.driver = NULL;
> > > > -			return error;
> > > > -		}
> > > > -	}
> > > > -	return 0;
> > > > +	return device_driver_attach(&drv->driver, &serio->dev);
> > > 
> > > I am not sure how safe it is, serio (and gameport) have pretty elaborate
> > > structure and locking rules because they can recurse into themselves (to
> > > support case of Synaptics touch-pads with pass-through PS/2 ports).
> > > 
> > > But this call is for user-initiated probing anyways, I am not sure if it
> > > even needs "trust" handling.
> > 
> > This patch does not change the locking; the lock was already held on paths such
> > as the rescan path. This change makes that explicit.
> 
> Does this enforce synchronous probing?

No, it ensures that a device is bound to only one driver at a time,
without races.

> 
> Anyway, I would like to get rid of this special probing in serio core.
> Given that the code path is only triggered by explicit user request I do
> not believe we need to worry about supporting trust notion here, so
> please drop it from the series.

Technically, this is exactly the flow we should be concerned about. Users
attempting to load the driver generally don't know whether their device is
trusted; attestation software is responsible for determining that. I modified
serio to ensure that driver attachment happens under the driver core lock.

One idea I had over the weekend was to introduce a special API for driver
attachment that says, "I don't care." It would allow attachment only in
"full" mode, as it does now, and fail in any other trust mode.

Thanks.
> 
> Thanks.
> 
> -- 
> Dmitry
> 
Technical Details
Message-ID: <20261106143340.GL8298@unreal>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-358037-linux-kernel-netdev=dewy.ru
References: <20261105-device-trust-core-v1-0-1e536825b4eb@nvidia.com> <20261105-device-trust-core-v1-2-1e536825b4eb@nvidia.com> <auy2plYVi723Qt42@google.com> <20261105191940.GI8298@unreal> <auzno3uoL5Pfojfl@google.com>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-358037-linux-kernel-netdev=dewy.ru
From: leon@kernel.org (Leon Romanovsky)
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH 02/17] Input: serio - attach manual drivers through the
 driver core
Date: Fri, 6 Nov 2026 16:33:40 +0200
Organization: Usenet Network
Message-ID: <20261106143340.GL8298@unreal>
References: <20261105-device-trust-core-v1-0-1e536825b4eb@nvidia.com>
 <20261105-device-trust-core-v1-2-1e536825b4eb@nvidia.com>
 <auy2plYVi723Qt42@google.com>
 <20261105191940.GI8298@unreal>
 <auzno3uoL5Pfojfl@google.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Injection-Info: usenet.network;
	logging-data="3904512"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:+jN3yOdHe/23QX6/VB/+MEas2Wk= sha256:8MXdtmzuiX4ABB9RIhroXLhT2/oZX/hp1bTZKSjkyfI=
	sha1:0OiGs7mUCxj52qNQfhKrz+1OG9g= sha256:ZyXgH9zbiFiFSFRveECSYWvjyRc5nFuRJX8VBf3tr2c=
Content-Disposition: inline
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 EB70C113284; Fri,  6 Nov 2026 17:47:54 +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 hpeNAW-I9EV3;
	Fri,  6 Nov 2026 17:47:51 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=104.64.211.4; helo=sin.lore.kernel.org; envelope-from=netdev+bounces-358037-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 1A61F113282; Fri,  6 Nov 2026 17:47:42 +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 813AF2C9CE; Fri,  6 Nov 2026 14:34:07 +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=1793975644;
	b=h5AH8QKukpc6Li16lWuLSnyuVN8nsJlKqH6vm3tFaB/QCZphn+NCjFqJPiJNTPWk+pKP
	 sICxlt/aH3+4O+FpYrBE/3HU7c6nNTc2sf/3NWFcA7V3RJVHDB8X4OZeQDLNCfK33HOsQ
	 p4jSIUVHaZTEBKewceBUW/tAEjYXa/JtSopo+KTSYPPPIHPTbGhzc9WhDr6Fq1i7YZpbF
	 rr9DKfcFO/dlB2n0N87OUMg6F5JJUP/lbOrmGSsPOskG1HcAzjND7B7xcD2lZo2nj9fFz
	 ASxWNCH+gnQMM6N+NYkHb1e4zo9QaOTqvSXFwluxG2qFoY2TfcOKlhW+vfYZf4nP6Eg==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1793975644;
	h=X-Original-To:Received:Received:DKIM-Signature:Date:From:To:Cc:
	 Subject:Message-ID:References:X-Mailing-List:List-Id:List-Post:
	 List-Help:List-Subscribe:List-Unsubscribe:List-Owner:Precedence:
	 MIME-Version:Content-Type:Content-Disposition:In-Reply-To;
	bh=wtqvUty3awL+WV2C4Bd+4jjQ8JiJNaHCJXSR0TJ5v3A=;
	b=Y5IHL/sD87kSGM+9IVPn9zCFqozrIPE1LmNj1wYPfYMdNKeE/VrrEiJkTE2UwgHK7At/
	 t70fdqteuuUQRBsmutkrlp0RWG+idXSMLzpfNS2lG9JAXWAjL991FJ21iLCOHZxhW2kyL
	 apOXSHcJIu0Vnoj4st0wbj8CyPPgyzkP0Yaf/NLHIpbSQ9GDg4iiEPJHNdJv+SYrtKRIg
	 GRWv7FhGIz8pT3dnucw1OAu5/KC/GEMr8LNo0zre9Kp96BHMfsIWEjebO+0y0DSMP5x6D
	 G9LXxvwWSVtE9N3ivjKidEUfCfCm+TSMbzKhLS2nkZMgNpXG70geLN2wTT4pWV7CATQ==
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=b2r2H5Bd;
	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 19184606A337;
	Fri,  6 Nov 2026 14:34:04 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key, unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=b2r2H5Bd
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=1793975626;
	b=Z7c2hVuIBjcSvK6tHze21UzbNXrNQwRYF9S8sd5qgmNl4zvF5ZyD7sgsyuBSCdnmjVY0
	 Hp/bUXCansnt/zILvVc4ibJGot6vh6Ymrv5iY6YNYDaQD4XKG5KrcWalb19nCU3adJ682
	 yjN40tFwO39qfUrJ/17wF5o8oSIlqdXeUpJjS2bkhKOAvhZvb1qLJF7vWBLPDWl5061R7
	 56/3ZJRWzI3K7607pFqhMF9E1Rfq8hW89dlPoFWcD6f7ufHBDEEseE1DLENtPyQKWzQKZ
	 ZZSVcoZK7VQKMIv/uT8wLITK5y6+ExFKWX/Dz2Akp+CijXtk78HYYXRaYcVhaoeMlrg==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1793975626;
	h=Received:DKIM-Signature:Date:From:To:Cc:Subject:Message-ID:
	 References:MIME-Version:Content-Type:Content-Disposition:In-Reply-To;
	bh=wtqvUty3awL+WV2C4Bd+4jjQ8JiJNaHCJXSR0TJ5v3A=;
	b=yQzm4CfK2F9ZYjA2mIbjoeprcosHEdNNYxr3L1jgrtO4GxgMaTdKcDgd0UTpHBltDfJa
	 ztMhbK3nfnpX+vEilGUwKtzNysu0wPRgSa7R3ovGzSuvI4q085TzzJsYn04ZGMjOrkrzi
	 2B771f91iFKJwlsDgj73cRdrR/U2oswgItNA35M+zz4FwbG/Tq3Sxup4bhnYVzKPWba98
	 oL9SHgc72QDyZL+41/14kb8wJEyGeYJ861q0z2aSBx4lA9bsj/qqjbK7ewW0rOgmU7Ucy
	 ahW+TYvzrjcpLWGapc/60DhflNyRrkyFs6k7kFbujgN43nKwnZt1fzyoQjFBqrrwkTg==
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=b2r2H5Bd;
	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 CED22606A32C;
	Fri,  6 Nov 2026 14:33:45 +0000 (UTC)
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 86EA81F0089F;
	Fri,  6 Nov 2026 14:33:44 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org;
	s=k20260515; t=1793975625;
	bh=wtqvUty3awL+WV2C4Bd+4jjQ8JiJNaHCJXSR0TJ5v3A=;
	h=Date:From:To:Cc:Subject:References:In-Reply-To;
	b=b2r2H5BdxpXdgNiFxLfKLsliHD1aW/wDAEDaKEhpVM3EC5rk9Xr6npFA/IH2FuBji
	 UDxYAgdQaJNICIZINw9Ilbfw8bLsyrsQzWp+NoPqhA/+jsoa6GKznm54YiNoZU+9oJ
	 sKCs6bWl1EjHh98hGORYkKB0GcOkK/HjEQjgTReSqakMKK6efSYleyQ6zh8ZhPS7y0
	 0wS9qzyBqM/XWz66nB/U7xvUJNcHVDCJop7XlyB7M2TSiH7wu9UstnvOKKmLIrUiaj
	 f3Nh+j2TKg+aNrfLE9k32yn/pJAm68XoJQeSANboxqzmkjEzD0Fm3hpnEuFuKwhEfE
	 9n14k2PzJGEaQ==
X-Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	"Rafael J. Wysocki" <rafael@kernel.org>,
	Danilo Krummrich <dakr@kernel.org>, Andrew Lunn <andrew@lunn.ch>,
	Heiner Kallweit <hkallweit1@gmail.com>,
	Russell King <linux@armlinux.org.uk>,
	"David S. Miller" <davem@davemloft.net>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	Johannes Berg <johannes@sipsolutions.net>,
	Jonathan Corbet <corbet@lwn.net>,
	Shuah Khan <skhan@linuxfoundation.org>,
	Randy Dunlap <rdunlap@infradead.org>,
	Bjorn Helgaas <bhelgaas@google.com>,
	"Joerg Roedel (AMD)" <joro@8bytes.org>,
	Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>,
	Vasant Hegde <vasant.hegde@amd.com>, Will Deacon <will@kernel.org>,
	Robin Murphy <robin.murphy@arm.com>,
	David Woodhouse <dwmw2@infradead.org>,
	Lu Baolu <baolu.lu@linux.intel.com>,
	Johan Hovold <johan@kernel.org>, Eric Dumazet <edumazet@kernel.org>,
	Marcel Holtmann <marcel@holtmann.org>,
	Luiz Augusto von Dentz <luiz.dentz@gmail.com>,
	Nipun Gupta <nipun.gupta@amd.com>,
	Nikhil Agarwal <nikhil.agarwal@amd.com>,
	Pieter Jansen van Vuuren <pieter.jansen-van-vuuren@amd.com>,
	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, Jason Gunthorpe <jgg@ziepe.ca>
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-In-Reply-To: <auzno3uoL5Pfojfl@google.com>