Skip to contentSkip to conversation

Fix for "Badness in kobject_get" (affected ieee1394)

BKPATCH Ben Collins 2 participants 3 messages Feb 12, 2004 – Feb 13, 2004 Driver core

lore
Share & tools
lore
#0 lore raw

This seems to have only affected ieee1394 because it uses bus_for_each_dev in a particular (although correct) way.

Linux/Andrew/Greg, if you want to pull this from my repo, I can email you the bk url privately.

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], 2004-02-12 09:51:06-05:00, [email protected]
[DRV/BASE]: Put checks in bus_for_each_{dev,drv} to make sure we don't go past the end of the list.

 bus.c |   16 ++++++++++++++--
 1 files changed, 14 insertions(+), 2 deletions(-)
drivers/base/bus.c +14 -2
diff -Nru a/drivers/base/bus.c b/drivers/base/bus.c
@@ -168,7 +168,13 @@
 
 	down_read(&bus->subsys.rwsem);
 	list_for_each(entry,head) {
-		struct device * dev = get_device(to_dev(entry));
+		struct device *dev;
+
+		/* End of list */
+		if (entry == &bus->devices.list)
+			break;
+
+		dev = get_device(to_dev(entry));
 		error = fn(dev,data);
 		put_device(dev);
 		if (error)
@@ -212,7 +218,13 @@
 
 	down_read(&bus->subsys.rwsem);
 	list_for_each(entry,head) {
-		struct device_driver * drv = get_driver(to_drv(entry));
+		struct device_driver *drv;
+
+		/* End of list */
+		if (entry == &bus->drivers.list)
+			break;
+
+		drv = get_driver(to_drv(entry));
 		error = fn(drv,data);
 		put_driver(drv);
 		if(error)

===================================================================

This BitKeeper patch contains the following changesets:
1.1634
## Wrapped with gzip_uu ##

M'XL( +.3*T [64;6O;,!#'7UN?XJ"PK=UB2Y9DQRXI?4C9Q@8+*=V;;03%
M5N(0QRJ2G+;,^^Z38YJN-!MTM'Y \OGOXW=W?[P'ET;JU)MFJBP7E4%[\$$9 MFWJYG"Y$Y2L]=Z&Q4BX4U$8'1F?!4NI*EH'3US>]T(^0DXR$S0I82VU2C_AT M&[&W5S+UQN?O+S^?C!$:#."L$-5<7D@+@P&R2J]%F9MC88M25;[5HC(K:86? MJ56SE38AQJ$[.8DIYE%#(LSB)B,Y(8(1F>.0]2-VGZU0*^DKDY=M 0_3,!P2 M3!*2T*2A<<(C- 3BDX@RP"S 84!"P$G*28JC'N8IQG#7G./[IL!; CV,3N%Y M"SA#&7P;CK\&IR<7YS]2&-46LD)F2P.+"J:UF<R4GDB1%9.?N5R_R_7ZET. ME5A*,+66<"TA5]5K"W,%5\)8L(4$6>6@9IMMN3#61Y^ ]BF+T>A^&JCWQ ,A M+# [email protected],I*^%?Y3=?WRM6<ZT5KB& JC P<O)]U;> A"XF[>1/Q,.8- MS?*$4R[Z2<SE+":[&OZ79.TT0\)81&A#,8WZ&XL]UK9>>W[0NY1;I^U.1'%" M,>$\H=P].@=L+,?I \.Q*"7TGX9CT M?Q'$OZ++-2+Y 3U]O+N>:T8[I_(?W MAL3YA*"/[1(CSS-6UYD%A[O()!RX]1!]=_'@ ,X[KI8)#@(76\S@C:RLOG6N M@%>.H'?4?6?\5K3O)-Y42['L4KAW,("YM)-.]<:J=M>EV-\_1,.0\):E71ZQ L3+IR'9)^(E+7IMU(>HNT46V0]!](V_]O-]=Z->"",=$G&/T&#+NI(_,%

Signature · 4 lines
Debian     - http://www.debian.org/
Linux 1394 - http://www.linux1394.org/
Subversion - http://subversion.tigris.org/
WatchGuard - http://www.watchguard.com/
#1 lore raw
Quoted 2 lines · Ben Collins

This seems to have only affected ieee1394 because it uses bus_for_each_dev in a particular (although correct) way.

[...]

Quoted 2 lines

[email protected], 2004-02-12 09:51:06-05:00, [email protected]
[DRV/BASE]: Put checks in bus_for_each_{dev,drv} to make sure we don't go past the end of the list.

Thanks, I applied this on top of 2.6.3-rc2-mm1 and it fixed my crash at boot problem. I'll do more extensive testing of the 1394 subsystem later today.

Signature · 1 line
Torrey Hoffman <[email protected]>
#2 lore raw
Quoted 11 lines · Torrey Hoffman
Quoted 2 lines · Ben Collins

This seems to have only affected ieee1394 because it uses bus_for_each_dev in a particular (although correct) way.

[...]

Quoted 2 lines

[email protected], 2004-02-12 09:51:06-05:00, [email protected]
[DRV/BASE]: Put checks in bus_for_each_{dev,drv} to make sure we don't go past the end of the list.

Thanks, I applied this on top of 2.6.3-rc2-mm1 and it fixed my crash at boot problem. I'll do more extensive testing of the 1394 subsystem later today.

After much discussion, Linus put together a cleaner more correct patch which is in the latest bk.

Signature · 4 lines
Debian     - http://www.debian.org/
Linux 1394 - http://www.linux1394.org/
Subversion - http://subversion.tigris.org/
WatchGuard - http://www.watchguard.com/