Re: regression w/ qla2300 - oopses..

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, 2005-08-26 at 14:52 -0700, Andrew Morton wrote:
> Is there not some nasty little hack we can do to make the crash go away in
> the interim?

Well, it's nasty.  The problem is that klist_next() refers to the
previous element to get the next one.  However, this previous element
has just been removed and freed.  We could try to open code the
necessary gets and puts in next_device().

Could someone check the attached, I think it's the correct open coding?

James

diff --git a/drivers/base/core.c b/drivers/base/core.c
--- a/drivers/base/core.c
+++ b/drivers/base/core.c
@@ -369,8 +369,20 @@ void device_unregister(struct device * d
 
 static struct device * next_device(struct klist_iter * i)
 {
+	struct device *dev;
+	struct device *odev = i->i_cur ?
+		container_of(i->i_cur, struct device, knode_parent) : NULL;
 	struct klist_node * n = klist_next(i);
-	return n ? container_of(n, struct device, knode_parent) : NULL;
+
+	if (odev)
+		put_device(odev);
+
+	dev = n ? container_of(n, struct device, knode_parent) : NULL;
+
+	if (dev)
+		get_device(dev);
+	
+	return dev;
 }
 
 /**


-
: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]
  Powered by Linux