lkml.org 
[lkml]   [2002]   [Jun]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[patch] bad locking in {driver,bus}_for_each_{drv,dev}
Date
Hi,

I just ran in a deadlock in driver_for_each_dev, where read_unlock
was called without the lock being held. The patch below avoids the
problem there and in the other two places I found it.

Arnd <><

--- linux-2.5.21/drivers/base/driver.c Thu Jun 13 19:00:48 2002
+++ drivers/base/driver.c Thu Jun 13 19:01:25 2002
@@ -31,6 +31,7 @@
dev = next;
if ((error = callback(dev,data))) {
put_device(dev);
+ read_lock(&drv->lock);
break;
}
read_lock(&drv->lock);
--- linux-2.5.21/drivers/base/bus.c Thu Jun 13 19:05:25 2002
+++ drivers/base/bus.c Thu Jun 13 19:06:01 2002
@@ -61,6 +61,7 @@
dev = next;
if ((error = callback(dev,data))) {
put_device(dev);
+ read_lock(&bus->lock);
break;
}
read_lock(&bus->lock);
@@ -96,6 +97,7 @@
drv = next;
if ((error = callback(drv,data))) {
put_driver(drv);
+ read_lock(&bus->lock);
break;
}
read_lock(&bus->lock);
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
\
 
 \ /
  Last update: 2005-03-22 13:26    [W:0.115 / U:0.024 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site