Hi,
this addresses the FIXME in devio.c::proc_ioctl() and makes
BKL usage in this function correct.
But the USBDEVFS_DISCONNECT ioctl is still fundamentally
broken.
Switching drivers for a device must be atomic with one
ioctl, else there's a race which you cannot fix. The locking
must be done in kernel space.
A similar race exists for usage through usbfs, only that
there's no simple fix. Comments?
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], 2002-11-30 15:13:17+01:00, [EMAIL PROTECTED]
- cleanup BKL
devio.c | 16 ++++++++--------
1 files changed, 8 insertions(+), 8 deletions(-)
diff -Nru a/drivers/usb/core/devio.c b/drivers/usb/core/devio.c
--- a/drivers/usb/core/devio.c Sat Nov 30 15:14:00 2002
+++ b/drivers/usb/core/devio.c Sat Nov 30 15:14:00 2002
@@ -1090,12 +1090,10 @@
else switch (ctrl.ioctl_code) {
/* disconnect kernel driver from interface, leaving it unbound. */
+ /* maybe unbound - you get no guarantee it stays unbound */
case USBDEVFS_DISCONNECT:
- /* this function is voodoo. */
- /* which function ... usb_device_remove()?
- * FIXME either the module lock (BKL) should be involved
- * here too, or the 'default' case below is broken
- */
+ /* this function is misdesigned - retained for compatibility */
+ lock_kernel();
driver = ifp->driver;
if (driver) {
dbg ("disconnect '%s' from dev %d interface %d",
@@ -1103,11 +1101,14 @@
usb_device_remove(&ifp->dev);
} else
retval = -ENODATA;
+ unlock_kernel();
break;
/* let kernel drivers try to (re)bind to the interface */
case USBDEVFS_CONNECT:
+ lock_kernel();
retval = usb_device_probe (&ifp->dev);
+ unlock_kernel();
break;
/* talk directly to the interface's driver */
@@ -1129,11 +1130,10 @@
}
unlock_kernel ();
retval = driver->ioctl (ifp, ctrl.ioctl_code, buf);
+ if (retval == -ENOIOCTLCMD)
+ retval = -ENOTTY;
put_module (driver->owner);
}
-
- if (retval == -ENOIOCTLCMD)
- retval = -ENOTTY;
}
/* cleanup and return */
===================================================================
This BitKeeper patch contains the following changesets:
1.1071
## Wrapped with gzip_uu ##
begin 664 bkpatch2522
M'XL(`*C'Z#T``ZU4T4[;,!1]CK_B2KS`4!I?.VG:HDZ,@C8$&XC!PYXF)W%3
MJZE=Q0Y;I7S\G%2#H16FL5EY<.[Q/3GGYB1[<&=E/0E,I>YE3?;@@['.WTIM
MM!PLS$I62C??!Z8N/7ACC`>CKAQM.Z)L&;I:2AN5M2Q90ORI:^'R!7C03@(<
M\(>*VZSE)+@Y>W]W^>Z&[EMAIL PROTECTED];8\+AI9#9:U$8ON@>T#W#)*
M$9$EE"=#3%HVXCQN<4BSPF\+EH[GV7!,MI*.=XE_RL40.46><,^%+(W'Y!1P
M@#1%H"Q"C#@%3";()Y@>4IQ0"B]PPR%"2,D)_+N#&<DAA+R20C=K.+FX)!?@
M!28QN7X<%@G_<A%"!25O=^@KZLZ5C1J;186\5V:0/RJ-Z1C3%D=Q.FH3-D<Y
MYPPS)FF&_*5Y/&'-32U_I=Z./D;NJ6F:#K$/PG,=NW/Q:M4O)N3/JGGBA;=T
MR/W[Z`(S3%X7EQ&$H_\8%RNT<LK*+B_06%'*OKQ2>6W,VJF5LL(IHWV6^H%?
M05A_ZR\?C>MG9_^*F)TC'3-``ML5O8&5V&02&IV91A=>U,8T4/KO71LH&U$+
M[:0$Y<`ZL;$/Y]Y$Y-13Q9#TE"-@)`@\FULH"_-&YYT=\'MOK9!6E5IVY+5T
M0G7;N:DA-ZNUMYVI2KE-QQ@$E<F77Y>RUK+:/SCRU$@3KS8(&KT#&O?0[P#2
M9WLX]DH#-8=]+^9>5#[`$)Y]NCJ_FMU>SCZ>'G1P\!/KH=O;+T?>+O(8^./O
8,U_(?&F;U93',1NE-"4_`,1/?U^K!0``
`
end
-------------------------------------------------------
This SF.net email is sponsored by: Get the new Palm Tungsten T
handheld. Power & Color in a compact size!
http://ads.sourceforge.net/cgi-bin/redirect.pl?palm0002en
_______________________________________________
[EMAIL PROTECTED]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel