patch-2.3.4 linux/net/netrom/nr_route.c

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

diff -u --recursive --new-file v2.3.3/linux/net/netrom/nr_route.c linux/net/netrom/nr_route.c
@@ -564,10 +564,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_NETROM)
 			if (first == NULL || strncmp(dev->name, first->name, 3) < 0)
 				first = dev;
+	}
+	read_unlock_bh(&dev_base_lock);
 
 	return first;
 }
@@ -579,11 +582,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_NETROM && ax25cmp(addr, (ax25_address *)dev->dev_addr) == 0)
-			return dev;
-
-	return NULL;
+			goto out;
+	}
+out:
+	read_unlock_bh(&dev_base_lock);
+	return dev;
 }
 
 static ax25_digi *nr_call_to_digi(int ndigis, ax25_address *digipeaters)

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