Am Montag, 11. August 2003 22:58 schrieb Greg KH:
> On Mon, Aug 11, 2003 at 10:49:05PM +0200, Oliver Neukum wrote:
> > Am Montag, 11. August 2003 22:20 schrieb Greg KH:
> > > On Mon, Aug 11, 2003 at 09:44:42PM +0200, Oliver Neukum wrote:
> > > > Hi,
> > > >
> > > > this function races with itself, doesn't return errors and races with
> > > > releasing interfaces. This patch fixes it by changing the function
> > > > prototype, introducing locking and having a correct order in
> > > > releasing interfaces.
> > >
> > > So you're using the fact that lock_kernel() can recurse here, right?
> > > That's not pretty :(
> >
> > Actually no. It's just not worth introducing another dedicated lock
> > and we are in -test where I strive for minimal changes in core
> > code.
>
> I strive for correctness :)
> Is there a better way you can think of solving this without using the
> BKL?
Not without touching messy parts of usbfs.
> > > Hm, I _really_ hate this function in the first place, but I can see how
> > > it could be necessary for some devices. Since currently probe() is
> > > called sequentially for a device (no other interfaces on the same device
> > > can be called at the same time), this lock isn't really necessary,
> > > right?
> >
> > Not so, interfaces are claimed by usbfs as well.
>
> Bleah, I keep forgetting about usbfs...
At some point you pay for having two ways to determine ownership
of interfaces.
> > > I really don't want to add lock_kernel() here if we can avoid it.
> >
> > Usbfs assumes BKL here.
>
> But the probe() sequence doesn't, right? So we are just protecting
> ourself from usbfs, correct? If so, how about a nice comment about that
> here, as that's all we are trying to prevent the race for.
You shall have your comment. However I object in principle against
exporting generic racy APIs.
The question about reliance is a good one generically speaking.
2.4 does again in usbfs depend on BKL. Somebody will have to audit
all those code paths. However as I will get onto a bus tomorrow
leaving my laptop at home, if all goes well, that won't be me in the
forseeable future.
Regards
Oliver
You can import this changeset into BK by piping this whole message to:
'| bk receive [path to repository]' or apply the patch as usual.
===================================================================
[EMAIL PROTECTED], 2003-08-11 23:08:16+02:00, [EMAIL PROTECTED]
- update commentary
usb.c | 1 +
1 files changed, 1 insertion(+)
diff -Nru a/drivers/usb/core/usb.c b/drivers/usb/core/usb.c
--- a/drivers/usb/core/usb.c Mon Aug 11 23:09:09 2003
+++ b/drivers/usb/core/usb.c Mon Aug 11 23:09:09 2003
@@ -268,6 +268,7 @@
if (!iface || !driver)
return -EINVAL;
+ /* this is mainly to lock against usbfs */
lock_kernel();
if (iface->driver) {
unlock_kernel();
===================================================================
This BitKeeper patch contains the following changesets:
1.2217
## Wrapped with gzip_uu ##
begin 664 bkpatch25317
M'XL(`/4%.#\``\U4T6K;,!1]MK[B0M]:8E])EFT9/+IU8QL;+&3K!\BR&@?'
M5K'DC8`_?DHR&CK2CG4O$Q)<Z4KG'AT==`&WSHQE9+>;[V8D%_#!.E]&(>ZG
[EMAIL PROTECTED],[KD-N96W():WM37(\D'P;C7&)ZOSD:A*V+)77+82,*R,:\X<5
MO[LW9;1Z]_[V\^L5(54%-ZT:UN:K\5!5I.ZNF\ELXVZTJMU7FQ_2,T.DE#*!
M7&14S*S@/)UIAG43PH;E\J[.)[EMAIL PROTECTED]@+S(B5O@<:,T1R0
M)[EMAIL PROTECTED])18ES:Z0E8CP-#1<45@@>0/_SO^&:%C`=-\H;T#;OC>#5^..?((]
M2TF6)\'(XB\;(:B0O#K#LAGW5W-)>+W]B/6);8J29C/CJ4AGG3%C1!%$TK7B
M*)Z1Y!&DMJ,YX1ZD9Q2+(#W-"IH=?'!^_WE3O)#N<^;X`UTJN6393'D(?SF%
M_6X4E/^'48Z:?H'%^./0P\,OGY#W!1;ZR'($2J+D$GR[<1!ZKS;[EMAIL PROTECTED]>PM;J
D#M0ZS)V'4.'[EMAIL PROTECTED]:W3GIKZJ1:TY\IS\!'I*7`]X!```
`
end
-------------------------------------------------------
This SF.Net email sponsored by: Free pre-built ASP.NET sites including
Data Reports, E-commerce, Portals, and Forums are available now.
Download today and enter to win an XBOX or Visual Studio .NET.
http://aspnet.click-url.com/go/psa00100003ave/direct;at.aspnet_072303_01/01
_______________________________________________
[EMAIL PROTECTED]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel