Linux PCI subsystem development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Leon Romanovsky" <leon@kernel.org>
Cc: linux-input@vger.kernel.org, linux-usb@vger.kernel.org,
	linux-pci@vger.kernel.org, dmitry.torokhov@gmail.com
Subject: Re: [PATCH v2 14/19] driver core: Accept device trust policy by driver name
Date: Tue, 10 Nov 2026 07:35:22 +0000	[thread overview]
Message-ID: <sashiko-outbox-206514@kernel.org> (raw)
In-Reply-To: <20261109-device-trust-core-v2-14-3b12d9a9f861@nvidia.com>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [High] usb: core: usb_driver_claim_interface() ignores
  device_trust.driver=
--

commit 411f8a29f95104232dcf95e09cd04a0c125becd0
Author: Leon Romanovsky <leon@kernel.org>

driver core: Accept device trust policy by driver name

This commit adds the device_trust.driver= kernel command-line parameter to
configure initial device trust policies by bus and driver name, and checks
trust policy when claiming unregistered USB interfaces.

> diff --git a/drivers/usb/core/driver.c b/drivers/usb/core/driver.c
> index ee36eae34bdcc..04b77691fbd7d 100644
> --- a/drivers/usb/core/driver.c
> +++ b/drivers/usb/core/driver.c
> @@ -563,6 +563,10 @@ int usb_driver_claim_interface(struct usb_driver *driver,
>  	if (!iface->authorized)
>  		return -ENODEV;
>  
> +	if (!device_is_registered(dev) &&
> +	    dev->trust_policy == DEVICE_TRUST_POLICY_DISABLED)
> +		return -EPERM;
> +
>  	dev->driver = &driver->driver;
>  	usb_set_intfdata(iface, data);
>  	iface->needs_binding = 0;

[Severity: High]
Does usb_driver_claim_interface() ignore device_trust.driver= rules when
checking an unregistered sibling interface?

In usb_set_configuration(), device_trust_init() sets each interface's
dev->trust_policy from device_trust.default= and device_trust= before the
device_add() loop, whereas device_trust.driver= is only evaluated in
__device_trust_prepare() during registration.

With device_trust.default=disabled and device_trust.driver=usb:<drv>=full,
probing interface 0 succeeds, but claiming an unregistered sibling from
probe() still sees DEVICE_TRUST_POLICY_DISABLED and fails with -EPERM.

Conversely, if device_trust.driver=usb:<drv>=disabled is set and interface
0 is allowed by a device_trust= entry, usb_driver_claim_interface() does
not reject the unregistered sibling claim with -EPERM.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261109-device-trust-core-v2-0-3b12d9a9f861@nvidia.com?part=14

  reply	other threads:[~2026-11-10  7:35 UTC|newest]

Thread overview: 51+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-09  7:33 [PATCH v2 00/19] driver core: Authorize device trust before driver binding Leon Romanovsky
2026-11-09  7:33 ` [PATCH v2 01/19] Input: gameport - attach manual drivers through the driver core Leon Romanovsky
2026-11-10  7:35   ` sashiko-bot
2026-11-09  7:33 ` [PATCH v2 02/19] wifi: mac80211_hwsim: lock device for manual driver binding Leon Romanovsky
2026-11-10  7:35   ` sashiko-bot
2026-11-09  7:33 ` [PATCH v2 03/19] USB: Lock registered interfaces during " Leon Romanovsky
2026-11-10  7:35   ` sashiko-bot
2026-11-10 14:19     ` Leon Romanovsky
2026-11-09  7:33 ` [PATCH v2 04/19] USB: Release interface claims refused during registration Leon Romanovsky
2026-11-10  7:35   ` sashiko-bot
2026-11-10 14:23     ` Leon Romanovsky
2026-11-09  7:33 ` [PATCH v2 05/19] PNP: Attach card devices through the driver core Leon Romanovsky
2026-11-10  7:35   ` sashiko-bot
2026-11-09  7:33 ` [PATCH v2 06/19] cdx: Propagate DMA configuration errors Leon Romanovsky
2026-11-10  7:35   ` sashiko-bot
2026-11-09  7:33 ` [PATCH v2 07/19] driver core: Report deferred probes through sysfs drivers_probe Leon Romanovsky
2026-11-10  7:35   ` sashiko-bot
2026-11-09  7:33 ` [PATCH v2 08/19] driver core: Add a compatibility API for manual driver attachment Leon Romanovsky
2026-11-10  7:35   ` sashiko-bot
2026-11-09  7:33 ` [PATCH v2 09/19] Input: serio - use the compatibility driver attachment API Leon Romanovsky
2026-11-10  7:35   ` sashiko-bot
2026-11-10 14:29     ` Leon Romanovsky
2026-11-09  7:33 ` [PATCH v2 10/19] net: phy: Use " Leon Romanovsky
2026-11-09 13:45   ` Andrew Lunn
2026-11-10  7:39     ` Leon Romanovsky
2026-11-10 14:31       ` Andrew Lunn
2026-11-10 14:58         ` Leon Romanovsky
2026-11-10  7:35   ` sashiko-bot
2026-11-09  7:33 ` [PATCH v2 11/19] driver core: Introduce a generic device trust level Leon Romanovsky
2026-11-10  7:35   ` sashiko-bot
2026-11-10 15:12     ` Leon Romanovsky
2026-11-09  7:33 ` [PATCH v2 12/19] driver core: Expose device trust authorization interfaces Leon Romanovsky
2026-11-10  7:35   ` sashiko-bot
2026-11-09  7:33 ` [PATCH v2 13/19] driver core: Accept device trust policy on the kernel command line Leon Romanovsky
2026-11-10  7:35   ` sashiko-bot
2026-11-09  7:33 ` [PATCH v2 14/19] driver core: Accept device trust policy by driver name Leon Romanovsky
2026-11-10  7:35   ` sashiko-bot [this message]
2026-11-09  7:33 ` [PATCH v2 15/19] driver core: Expose committed device trust level Leon Romanovsky
2026-11-10  7:35   ` sashiko-bot
2026-11-09  7:33 ` [PATCH v2 16/19] driver core: Cover trust authorization and binding with KUnit Leon Romanovsky
2026-11-10  7:35   ` sashiko-bot
2026-11-09  7:33 ` [PATCH v2 17/19] driver core: Document trust admission and initrd authorization Leon Romanovsky
2026-11-10  7:35   ` sashiko-bot
2026-11-09  7:33 ` [PATCH v2 18/19] PCI: Replace untrusted state with device trust Leon Romanovsky
2026-11-09 13:53   ` Robin Murphy
2026-11-10 12:22     ` Leon Romanovsky
2026-11-10 14:25       ` Jason Gunthorpe
2026-11-10 14:34         ` Leon Romanovsky
2026-11-10  7:35   ` sashiko-bot
2026-11-09  7:33 ` [PATCH v2 19/19] USB: Authorize devices and interfaces through " Leon Romanovsky
2026-11-10  7:35   ` sashiko-bot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=sashiko-outbox-206514@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=dmitry.torokhov@gmail.com \
    --cc=leon@kernel.org \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox