[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Pine.LNX.4.44L0.1909031009250.1859-100000@iolanthe.rowland.org>
Date: Tue, 3 Sep 2019 10:14:36 -0400 (EDT)
From: Alan Stern <stern@...land.harvard.edu>
To: Greg KH <greg@...ah.com>
cc: Oliver Neukum <oneukum@...e.com>,
Julius Werner <jwerner@...omium.org>,
USB Storage list <usb-storage@...ts.one-eyed-alien.net>,
Dan Williams <dcbw@...hat.com>,
Kernel development list <linux-kernel@...r.kernel.org>,
USB list <linux-usb@...r.kernel.org>
Subject: Re: [PATCH] usb: storage: Add ums-cros-aoa driver
On Tue, 3 Sep 2019, Greg KH wrote:
> On Tue, Sep 03, 2019 at 10:46:14AM +0200, Oliver Neukum wrote:
> > Am Montag, den 02.09.2019, 18:47 +0200 schrieb Greg KH:
> > >
> > > This should work just fine today. Add a new device id to the "new_id"
> > > file and then tell the driver to bind. That's pretty much the same as a
> > > "force_bind", right?
> >
> > That looks like a race condition by design to me.
>
> How?
>
> Anyway, this should all "just work" somehow, there's an old lwn.net
> article I wrote about this over a decade ago when it was added. A
> number of subsystems use this all the time (vfio?) and I haven't heard
> any issues with it in a long time.
No, this won't "just work". The problem is that when you write to the
new_id file, usb_store_new_id() calls driver_attach(), which tries to
bind the driver to any matching device. There _will_ be other matching
devices, and trying to bind them will cause runtime errors.
That isn't what we want. We want to bind the driver to a _specific_
device and no others, even if the others match the new id.
Now, this is what writing to the sysfs "bind" file does -- except that
it won't let you bind a driver to a device it doesn't match!
So we have two problems:
Bind a driver to a particular device,
Even though the id's for the device don't match the driver.
The kernel already contains solutions for each of these problems, but
nothing that can handle both at once.
Alan Stern
Powered by blists - more mailing lists