patch-2.3.4 linux/net/rose/rose_route.c

Next file: linux/net/sched/sch_api.c
Previous file: linux/net/netsyms.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.3.3/linux/net/rose/rose_route.c linux/net/rose/rose_route.c
@@ -543,10 +543,13 @@
 {
 	struct device *dev, *first = NULL;
 
-	for (dev = dev_base; dev != NULL; dev = dev->next)
+	read_lock_bh(&dev_base_lock);
+	for (dev = dev_base; dev != NULL; dev = dev->next) {
 		if ((dev->flags & IFF_UP) && dev->type == ARPHRD_ROSE)
 			if (first == NULL || strncmp(dev->name, first->name, 3) < 0)
 				first = dev;
+	}
+	read_unlock_bh(&dev_base_lock);
 
 	return first;
 }
@@ -558,11 +561,14 @@
 {
 	struct device *dev;
 
-	for (dev = dev_base; dev != NULL; dev = dev->next)
+	read_lock_bh(&dev_base_lock);
+	for (dev = dev_base; dev != NULL; dev = dev->next) {
 		if ((dev->flags & IFF_UP) && dev->type == ARPHRD_ROSE && rosecmp(addr, (rose_address *)dev->dev_addr) == 0)
-			return dev;
-
-	return NULL;
+			goto out;
+	}
+out:
+	read_unlock_bh(&dev_base_lock);
+	return dev;
 }
 
 struct rose_route *rose_route_free_lci(unsigned int lci, struct rose_neigh *neigh)

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)