Hi,
this should close the last unload race I know about.
Unfortunately 2.5 currently doesn't link for me. So here
it is. Somebody with an SMP testing this would be cool.
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-07-12 13:31:13+02:00, [EMAIL PROTECTED]
- fix module unload race
diff -Nru a/drivers/usb/core/usb.c b/drivers/usb/core/usb.c
--- a/drivers/usb/core/usb.c Fri Jul 12 14:20:00 2002
+++ b/drivers/usb/core/usb.c Fri Jul 12 14:20:00 2002
@@ -131,6 +131,7 @@
{
struct usb_driver *driver;
void *priv;
+ int m;
driver = intf->driver;
@@ -142,7 +143,11 @@
/* as soon as we increase the module use count we drop the BKL
before that we must not sleep */
if (driver->owner) {
- __MOD_INC_USE_COUNT(driver->owner);
+ m = try_inc_mod_count(driver->owner);
+ if (unlikely(m == 0)) {
+ err("Dieing driver still bound to device.\n");
+ return;
+ }
unlock_kernel();
}
down(&driver->serialize); /* if we sleep here on an umanaged driver
@@ -170,13 +175,15 @@
void *usb_bind_driver(struct usb_driver *driver, struct usb_device *dev, unsigned int
ifnum)
{
- int i;
+ int i,m;
void *private = NULL;
const struct usb_device_id *id;
struct usb_interface *interface;
if (driver->owner) {
- __MOD_INC_USE_COUNT(driver->owner);
+ m = try_inc_mod_count(driver->owner);
+ if (unlikely(m == 0))
+ return NULL; /* this horse is dead - don't ride*/
unlock_kernel();
}
===================================================================
This BitKeeper patch contains the following changesets:
1.659
## Wrapped with gzip_uu ##
begin 664 bkpatch2474
M'XL(`'#)+CT``ZV476^;,!2&K_&O.&HOEK8#;(SY2,74K9VV:M56=>K=I`K,
M:6*%X,E`VVCLO\^0*5&EK-/:(2/L<^S7CP\O[,-U@V;JZ$K=H2'[\%$WK1UB
MK6OTYGJ)E:J[!T^;F4U>:6V3_A#VURO\8N&V!K'Q[P-![)3+O)5SL)EFZC"/
M;R+MZCM.G:OW'ZXOWEX1DF5P.L_K&7[%%K*,%(N3LL/*6QB=SX?=^DVZ#RAE
MC`6"<A$QT0<)YV'/(EJ4MEL&<7I;1"E9\YSL(G^L%="8!32ED1"]B#F-R1DP
M+Q(IT,"GL<\"8'S*V93Q(QI,*84GI.&(@4O).WCY`4Z)!!=NU0,L==E5"%U=
MZ;P$DTLDGT`D42K(Y;9LQ/W'BQ":4_)F!VIIA@,V?M<4P^W)+7)(4Q;U`0]%
MV,LH0!1)P&)9Y)R*IPKS2%-J@UOA\04PQFVSM4A8,MIA]_S=WG@F+YD9G)VL
M9:1>_@V16@U!>Q:&$1\]PFCX3(]0</E_-(FJI<$EUNW&*DT^0Y"ZLR%[$H.R
MK5;6-.OR?@'7W(_-FN#R#Y5^AIW.&>?`B*,&D&-RQD)AA^?#0Q#'64(&K5G=
M6-H;RWDSXDW6N[MO]'V-YN#8SE.W,+%>5PNL5A.[*`-Z<``_;,9!8R9[9PI5
M/?N-#4VKJ@H*JU5"JZ'$.R71^U;OC5J.P;8S]=#]:8%B/@+%&TSU>@2-TW4\
M!?Y2T.VF\/GZXN(8_$-HYZJ!N38-@NV4:+]B%TI=OVK!J!(/_>V?4LY1+IIN
1F151(A**"?D%S-<24Y,%````
`
end
-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Gadgets, caffeine, t-shirts, fun stuff.
http://thinkgeek.com/sf
_______________________________________________
[EMAIL PROTECTED]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel