Re: [PATCH 05/17] USB: Lock registered interfaces during manual driver binding

From: Leon Romanovsky

Date: Sun Nov 08 2026 - 06:11:02 EST


On Thu, Nov 05, 2026 at 03:04:18PM -0500, Alan Stern wrote:
> On Thu, Nov 05, 2026 at 08:44:42PM +0200, Leon Romanovsky wrote:
> > On Thu, Nov 05, 2026 at 12:24:33PM -0500, Alan Stern wrote:
> > > On Thu, Nov 05, 2026 at 01:42:18PM +0200, Leon Romanovsky wrote:
> > > > From: Leon Romanovsky <leonro@xxxxxxxxxx>
> > > >
> > > > Interface claims hold the USB device lock, but device_bind_driver()
> > > > requires the target interface lock. Without it, trust-policy writes can
> > > > race admission.
> > >
> > > This says nothing about usb_driver_release_refused_claim() and the code
> > > related to it. It is an incomplete description of the patch.
> > >
> > > Note that nothing prevents drivers from using an interface they claim
> > > before that interface is registered. For your scheme to work properly,
> > > you should make sure the claim is authorized when
> > > usb_driver_claim_interface() is called, not when the interface is
> > > registered.
> >
> > This patch is unrelated to authorization;
>
> I meant "authorization" in its generic sense. When you don't trust
> something, you don't authorize it to do anything. Pretend I had written
> "the interface being claimed is trusted" in place of "the claim is
> authorized" above.

I will combine existing USB authorization scheme with device trust in v2.

>
> > it ensures that the lock is
> > acquired when the driver is bound.
>
> That may have been your intention when the patch was created, but if you
> read the patch you'll see that it includes a whole bunch of material
> not related to locking during binding. Namely, this part:

Once I added `device_lock()` to `bind`, I had to add it to `unbind` as well.

Thanks