Merge branch 'topic/misc' into for-linus
[safe/jmp/linux-2.6] / net / x25 / x25_route.c
index 060fcfa..97d77c5 100644 (file)
 
 #include <linux/if_arp.h>
 #include <linux/init.h>
+#include <linux/slab.h>
 #include <net/x25.h>
 
-struct list_head x25_route_list = LIST_HEAD_INIT(x25_route_list);
+LIST_HEAD(x25_route_list);
 DEFINE_RWLOCK(x25_route_list_lock);
 
 /*
@@ -129,15 +130,17 @@ void x25_route_device_down(struct net_device *dev)
  */
 struct net_device *x25_dev_get(char *devname)
 {
-       struct net_device *dev = dev_get_by_name(devname);
+       struct net_device *dev = dev_get_by_name(&init_net, devname);
 
        if (dev &&
            (!(dev->flags & IFF_UP) || (dev->type != ARPHRD_X25
 #if defined(CONFIG_LLC) || defined(CONFIG_LLC_MODULE)
                                        && dev->type != ARPHRD_ETHER
 #endif
-                                       )))
+                                       ))){
                dev_put(dev);
+               dev = NULL;
+       }
 
        return dev;
 }
@@ -190,7 +193,7 @@ int x25_route_ioctl(unsigned int cmd, void __user *arg)
                goto out;
 
        rc = -EINVAL;
-       if (rt.sigdigits < 0 || rt.sigdigits > 15)
+       if (rt.sigdigits > 15)
                goto out;
 
        dev = x25_dev_get(rt.device);