]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - net/ipv6/netfilter/ip6_queue.c
[NET]: Make device event notification network namespace safe
[linux-2.6-omap-h63xx.git] / net / ipv6 / netfilter / ip6_queue.c
index 0004db38af6d8e8abed0451195b30b57814809e6..64536a3ef2f6c2b30205d0080704435d68d6b87e 100644 (file)
@@ -24,6 +24,7 @@
 #include <linux/sysctl.h>
 #include <linux/proc_fs.h>
 #include <linux/mutex.h>
+#include <net/net_namespace.h>
 #include <net/sock.h>
 #include <net/ipv6.h>
 #include <net/ip6_route.h>
@@ -546,6 +547,9 @@ ipq_rcv_dev_event(struct notifier_block *this,
 {
        struct net_device *dev = ptr;
 
+       if (dev->nd_net != &init_net)
+               return NOTIFY_DONE;
+
        /* Drop any packets associated with the downed device */
        if (event == NETDEV_DOWN)
                ipq_dev_drop(dev->ifindex);
@@ -664,7 +668,7 @@ static int __init ip6_queue_init(void)
                goto cleanup_netlink_notifier;
        }
 
-       proc = proc_net_create(IPQ_PROC_FS_NAME, 0, ipq_get_info);
+       proc = proc_net_create(&init_net, IPQ_PROC_FS_NAME, 0, ipq_get_info);
        if (proc)
                proc->owner = THIS_MODULE;
        else {
@@ -685,7 +689,7 @@ static int __init ip6_queue_init(void)
 cleanup_sysctl:
        unregister_sysctl_table(ipq_sysctl_header);
        unregister_netdevice_notifier(&ipq_dev_notifier);
-       proc_net_remove(IPQ_PROC_FS_NAME);
+       proc_net_remove(&init_net, IPQ_PROC_FS_NAME);
 
 cleanup_ipqnl:
        sock_release(ipqnl->sk_socket);
@@ -705,7 +709,7 @@ static void __exit ip6_queue_fini(void)
 
        unregister_sysctl_table(ipq_sysctl_header);
        unregister_netdevice_notifier(&ipq_dev_notifier);
-       proc_net_remove(IPQ_PROC_FS_NAME);
+       proc_net_remove(&init_net, IPQ_PROC_FS_NAME);
 
        sock_release(ipqnl->sk_socket);
        mutex_lock(&ipqnl_mutex);