patch-2.3.15 linux/net/x25/x25_route.c

Next file: linux/scripts/mkdep.c
Previous file: linux/net/x25/x25_link.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.3.14/linux/net/x25/x25_route.c linux/net/x25/x25_route.c
@@ -42,7 +42,6 @@
 #include <linux/mm.h>
 #include <linux/interrupt.h>
 #include <linux/notifier.h>
-#include <linux/firewall.h>
 #include <net/x25.h>
 
 static struct x25_route *x25_route_list = NULL;
@@ -142,7 +141,7 @@
 {
 	struct net_device *dev;
 
-	if ((dev = dev_get(devname)) == NULL)
+	if ((dev = dev_get_by_name(devname)) == NULL)
 		return NULL;
 
 	if ((dev->flags & IFF_UP) && (dev->type == ARPHRD_X25
@@ -152,6 +151,8 @@
 	   ))
 		return dev;
 
+	dev_put(dev);
+
 	return NULL;
 }
 
@@ -183,6 +184,7 @@
 {
 	struct x25_route_struct x25_route;
 	struct net_device *dev;
+	int err;
 
 	switch (cmd) {
 
@@ -193,7 +195,9 @@
 				return -EINVAL;
 			if ((dev = x25_dev_get(x25_route.device)) == NULL)
 				return -EINVAL;
-			return x25_add_route(&x25_route.address, x25_route.sigdigits, dev);
+			err = x25_add_route(&x25_route.address, x25_route.sigdigits, dev);
+			dev_put(dev);
+			return err;
 
 		case SIOCDELRT:
 			if (copy_from_user(&x25_route, arg, sizeof(struct x25_route_struct)))
@@ -202,7 +206,9 @@
 				return -EINVAL;
 			if ((dev = x25_dev_get(x25_route.device)) == NULL)
 				return -EINVAL;
-			return x25_del_route(&x25_route.address, x25_route.sigdigits, dev);
+			err = x25_del_route(&x25_route.address, x25_route.sigdigits, dev);
+			dev_put(dev);
+			return err;
 
 		default:
 			return -EINVAL;

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