aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOctavian Purdila <opurdila@ixiacom.com>2009-11-25 18:14:13 -0500
committerDavid S. Miller <davem@davemloft.net>2009-11-25 18:14:13 -0500
commit09ad9bc752519cc167d0a573e1acf69b5c707c67 (patch)
tree0e190a9ffb90d7e0534136c3e9f31dce02f423c3
parent4ba3eb034fb6fd1990ccc5a6d71d5abcda37b905 (diff)
net: use net_eq to compare nets
Generated with the following semantic patch @@ struct net *n1; struct net *n2; @@ - n1 == n2 + net_eq(n1, n2) @@ struct net *n1; struct net *n2; @@ - n1 != n2 + !net_eq(n1, n2) applied over {include,net,drivers/net}. Signed-off-by: Octavian Purdila <opurdila@ixiacom.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/net/hamradio/bpqether.c4
-rw-r--r--drivers/net/loopback.c2
-rw-r--r--drivers/net/wan/hdlc.c4
-rw-r--r--net/appletalk/ddp.c2
-rw-r--r--net/atm/svc.c2
-rw-r--r--net/ax25/af_ax25.c2
-rw-r--r--net/can/af_can.c2
-rw-r--r--net/core/dev.c4
-rw-r--r--net/core/neighbour.c2
-rw-r--r--net/core/net-sysfs.c4
-rw-r--r--net/core/net_namespace.c2
-rw-r--r--net/core/sysctl_net_core.c2
-rw-r--r--net/dcb/dcbnl.c2
-rw-r--r--net/decnet/af_decnet.c2
-rw-r--r--net/decnet/dn_dev.c6
-rw-r--r--net/decnet/dn_fib.c4
-rw-r--r--net/decnet/dn_route.c4
-rw-r--r--net/decnet/dn_table.c2
-rw-r--r--net/econet/af_econet.c2
-rw-r--r--net/ieee802154/af_ieee802154.c2
-rw-r--r--net/ipv4/devinet.c2
-rw-r--r--net/ipv4/fib_semantics.c4
-rw-r--r--net/ipv4/inet_connection_sock.c4
-rw-r--r--net/ipv4/inet_hashtables.c3
-rw-r--r--net/ipv4/ip_fragment.c4
-rw-r--r--net/ipv4/ip_input.c2
-rw-r--r--net/ipv4/netfilter/ip_queue.c2
-rw-r--r--net/ipv4/route.c4
-rw-r--r--net/ipv4/sysctl_net_ipv4.c4
-rw-r--r--net/ipv6/addrconf.c4
-rw-r--r--net/ipv6/ip6_flowlabel.c9
-rw-r--r--net/ipv6/netfilter/ip6_queue.c2
-rw-r--r--net/ipv6/reassembly.c4
-rw-r--r--net/ipx/af_ipx.c2
-rw-r--r--net/llc/af_llc.c2
-rw-r--r--net/netfilter/nfnetlink_log.c2
-rw-r--r--net/netlink/af_netlink.c2
-rw-r--r--net/netrom/af_netrom.c2
-rw-r--r--net/packet/af_packet.c6
-rw-r--r--net/rose/af_rose.c2
-rw-r--r--net/rxrpc/af_rxrpc.c2
-rw-r--r--net/sched/act_api.c4
-rw-r--r--net/sched/cls_api.c4
-rw-r--r--net/sched/sch_api.c10
-rw-r--r--net/tipc/socket.c2
-rw-r--r--net/x25/af_x25.c2
46 files changed, 74 insertions, 72 deletions
diff --git a/drivers/net/hamradio/bpqether.c b/drivers/net/hamradio/bpqether.c
index fe893c91a01b..76abed9a70b1 100644
--- a/drivers/net/hamradio/bpqether.c
+++ b/drivers/net/hamradio/bpqether.c
@@ -186,7 +186,7 @@ static int bpq_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_ty
186 struct ethhdr *eth; 186 struct ethhdr *eth;
187 struct bpqdev *bpq; 187 struct bpqdev *bpq;
188 188
189 if (dev_net(dev) != &init_net) 189 if (!net_eq(dev_net(dev), &init_net))
190 goto drop; 190 goto drop;
191 191
192 if ((skb = skb_share_check(skb, GFP_ATOMIC)) == NULL) 192 if ((skb = skb_share_check(skb, GFP_ATOMIC)) == NULL)
@@ -552,7 +552,7 @@ static int bpq_device_event(struct notifier_block *this,unsigned long event, voi
552{ 552{
553 struct net_device *dev = (struct net_device *)ptr; 553 struct net_device *dev = (struct net_device *)ptr;
554 554
555 if (dev_net(dev) != &init_net) 555 if (!net_eq(dev_net(dev), &init_net))
556 return NOTIFY_DONE; 556 return NOTIFY_DONE;
557 557
558 if (!dev_is_ethdev(dev)) 558 if (!dev_is_ethdev(dev))
diff --git a/drivers/net/loopback.c b/drivers/net/loopback.c
index 1bc654a73c47..c9f65574378f 100644
--- a/drivers/net/loopback.c
+++ b/drivers/net/loopback.c
@@ -207,7 +207,7 @@ static __net_init int loopback_net_init(struct net *net)
207out_free_netdev: 207out_free_netdev:
208 free_netdev(dev); 208 free_netdev(dev);
209out: 209out:
210 if (net == &init_net) 210 if (net_eq(net, &init_net))
211 panic("loopback: Failed to register netdevice: %d\n", err); 211 panic("loopback: Failed to register netdevice: %d\n", err);
212 return err; 212 return err;
213} 213}
diff --git a/drivers/net/wan/hdlc.c b/drivers/net/wan/hdlc.c
index cc07236ea734..9937bbab938d 100644
--- a/drivers/net/wan/hdlc.c
+++ b/drivers/net/wan/hdlc.c
@@ -57,7 +57,7 @@ static int hdlc_rcv(struct sk_buff *skb, struct net_device *dev,
57{ 57{
58 struct hdlc_device *hdlc = dev_to_hdlc(dev); 58 struct hdlc_device *hdlc = dev_to_hdlc(dev);
59 59
60 if (dev_net(dev) != &init_net) { 60 if (!net_eq(dev_net(dev), &init_net)) {
61 kfree_skb(skb); 61 kfree_skb(skb);
62 return 0; 62 return 0;
63 } 63 }
@@ -102,7 +102,7 @@ static int hdlc_device_event(struct notifier_block *this, unsigned long event,
102 unsigned long flags; 102 unsigned long flags;
103 int on; 103 int on;
104 104
105 if (dev_net(dev) != &init_net) 105 if (!net_eq(dev_net(dev), &init_net))
106 return NOTIFY_DONE; 106 return NOTIFY_DONE;
107 107
108 if (!(dev->priv_flags & IFF_WAN_HDLC)) 108 if (!(dev->priv_flags & IFF_WAN_HDLC))
diff --git a/net/appletalk/ddp.c b/net/appletalk/ddp.c
index 73ca4d524928..9fc4da56fb1d 100644
--- a/net/appletalk/ddp.c
+++ b/net/appletalk/ddp.c
@@ -1023,7 +1023,7 @@ static int atalk_create(struct net *net, struct socket *sock, int protocol,
1023 struct sock *sk; 1023 struct sock *sk;
1024 int rc = -ESOCKTNOSUPPORT; 1024 int rc = -ESOCKTNOSUPPORT;
1025 1025
1026 if (net != &init_net) 1026 if (!net_eq(net, &init_net))
1027 return -EAFNOSUPPORT; 1027 return -EAFNOSUPPORT;
1028 1028
1029 /* 1029 /*
diff --git a/net/atm/svc.c b/net/atm/svc.c
index c7395070ee78..66e1d9b3e5de 100644
--- a/net/atm/svc.c
+++ b/net/atm/svc.c
@@ -655,7 +655,7 @@ static int svc_create(struct net *net, struct socket *sock, int protocol,
655{ 655{
656 int error; 656 int error;
657 657
658 if (net != &init_net) 658 if (!net_eq(net, &init_net))
659 return -EAFNOSUPPORT; 659 return -EAFNOSUPPORT;
660 660
661 sock->ops = &svc_proto_ops; 661 sock->ops = &svc_proto_ops;
diff --git a/net/ax25/af_ax25.c b/net/ax25/af_ax25.c
index d6ddfa4c4471..5588ba69c468 100644
--- a/net/ax25/af_ax25.c
+++ b/net/ax25/af_ax25.c
@@ -805,7 +805,7 @@ static int ax25_create(struct net *net, struct socket *sock, int protocol,
805 struct sock *sk; 805 struct sock *sk;
806 ax25_cb *ax25; 806 ax25_cb *ax25;
807 807
808 if (net != &init_net) 808 if (!net_eq(net, &init_net))
809 return -EAFNOSUPPORT; 809 return -EAFNOSUPPORT;
810 810
811 switch (sock->type) { 811 switch (sock->type) {
diff --git a/net/can/af_can.c b/net/can/af_can.c
index 833bd838edc6..f30671728864 100644
--- a/net/can/af_can.c
+++ b/net/can/af_can.c
@@ -126,7 +126,7 @@ static int can_create(struct net *net, struct socket *sock, int protocol,
126 if (protocol < 0 || protocol >= CAN_NPROTO) 126 if (protocol < 0 || protocol >= CAN_NPROTO)
127 return -EINVAL; 127 return -EINVAL;
128 128
129 if (net != &init_net) 129 if (!net_eq(net, &init_net))
130 return -EAFNOSUPPORT; 130 return -EAFNOSUPPORT;
131 131
132#ifdef CONFIG_MODULES 132#ifdef CONFIG_MODULES
diff --git a/net/core/dev.c b/net/core/dev.c
index ccefa2473c39..e65af6041415 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -985,7 +985,7 @@ rollback:
985 /* For now only devices in the initial network namespace 985 /* For now only devices in the initial network namespace
986 * are in sysfs. 986 * are in sysfs.
987 */ 987 */
988 if (net == &init_net) { 988 if (net_eq(net, &init_net)) {
989 ret = device_rename(&dev->dev, dev->name); 989 ret = device_rename(&dev->dev, dev->name);
990 if (ret) { 990 if (ret) {
991 memcpy(dev->name, oldname, IFNAMSIZ); 991 memcpy(dev->name, oldname, IFNAMSIZ);
@@ -4792,7 +4792,7 @@ static void rollback_registered_many(struct list_head *head)
4792 list_for_each_entry_safe(dev, aux, head, unreg_list) { 4792 list_for_each_entry_safe(dev, aux, head, unreg_list) {
4793 int new_net = 1; 4793 int new_net = 1;
4794 list_for_each_entry(fdev, &pernet_list, unreg_list) { 4794 list_for_each_entry(fdev, &pernet_list, unreg_list) {
4795 if (dev_net(dev) == dev_net(fdev)) { 4795 if (net_eq(dev_net(dev), dev_net(fdev))) {
4796 new_net = 0; 4796 new_net = 0;
4797 dev_put(dev); 4797 dev_put(dev);
4798 break; 4798 break;
diff --git a/net/core/neighbour.c b/net/core/neighbour.c
index e587e6819698..a08a35bf0a7b 100644
--- a/net/core/neighbour.c
+++ b/net/core/neighbour.c
@@ -2092,7 +2092,7 @@ static int neigh_dump_table(struct neigh_table *tbl, struct sk_buff *skb,
2092 if (h > s_h) 2092 if (h > s_h)
2093 s_idx = 0; 2093 s_idx = 0;
2094 for (n = tbl->hash_buckets[h], idx = 0; n; n = n->next) { 2094 for (n = tbl->hash_buckets[h], idx = 0; n; n = n->next) {
2095 if (dev_net(n->dev) != net) 2095 if (!net_eq(dev_net(n->dev), net))
2096 continue; 2096 continue;
2097 if (idx < s_idx) 2097 if (idx < s_idx)
2098 goto next; 2098 goto next;
diff --git a/net/core/net-sysfs.c b/net/core/net-sysfs.c
index 157645c0da73..fbc1c7472c5e 100644
--- a/net/core/net-sysfs.c
+++ b/net/core/net-sysfs.c
@@ -525,7 +525,7 @@ void netdev_unregister_kobject(struct net_device * net)
525 525
526 kobject_get(&dev->kobj); 526 kobject_get(&dev->kobj);
527 527
528 if (dev_net(net) != &init_net) 528 if (!net_eq(dev_net(net), &init_net))
529 return; 529 return;
530 530
531 device_del(dev); 531 device_del(dev);
@@ -559,7 +559,7 @@ int netdev_register_kobject(struct net_device *net)
559#endif 559#endif
560#endif /* CONFIG_SYSFS */ 560#endif /* CONFIG_SYSFS */
561 561
562 if (dev_net(net) != &init_net) 562 if (!net_eq(dev_net(net), &init_net))
563 return 0; 563 return 0;
564 564
565 return device_add(dev); 565 return device_add(dev);
diff --git a/net/core/net_namespace.c b/net/core/net_namespace.c
index 1c1af2756f38..86ed7f44d083 100644
--- a/net/core/net_namespace.c
+++ b/net/core/net_namespace.c
@@ -280,7 +280,7 @@ out_undo:
280 list_del(&ops->list); 280 list_del(&ops->list);
281 if (ops->exit) { 281 if (ops->exit) {
282 for_each_net(undo_net) { 282 for_each_net(undo_net) {
283 if (undo_net == net) 283 if (net_eq(undo_net, net))
284 goto undone; 284 goto undone;
285 ops->exit(undo_net); 285 ops->exit(undo_net);
286 } 286 }
diff --git a/net/core/sysctl_net_core.c b/net/core/sysctl_net_core.c
index 7db1de0497c6..fcfc5458c399 100644
--- a/net/core/sysctl_net_core.c
+++ b/net/core/sysctl_net_core.c
@@ -134,7 +134,7 @@ static __net_init int sysctl_core_net_init(struct net *net)
134 net->core.sysctl_somaxconn = SOMAXCONN; 134 net->core.sysctl_somaxconn = SOMAXCONN;
135 135
136 tbl = netns_core_table; 136 tbl = netns_core_table;
137 if (net != &init_net) { 137 if (!net_eq(net, &init_net)) {
138 tbl = kmemdup(tbl, sizeof(netns_core_table), GFP_KERNEL); 138 tbl = kmemdup(tbl, sizeof(netns_core_table), GFP_KERNEL);
139 if (tbl == NULL) 139 if (tbl == NULL)
140 goto err_dup; 140 goto err_dup;
diff --git a/net/dcb/dcbnl.c b/net/dcb/dcbnl.c
index ac1205df6c86..2afd617104d2 100644
--- a/net/dcb/dcbnl.c
+++ b/net/dcb/dcbnl.c
@@ -1126,7 +1126,7 @@ static int dcb_doit(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg)
1126 u32 pid = skb ? NETLINK_CB(skb).pid : 0; 1126 u32 pid = skb ? NETLINK_CB(skb).pid : 0;
1127 int ret = -EINVAL; 1127 int ret = -EINVAL;
1128 1128
1129 if (net != &init_net) 1129 if (!net_eq(net, &init_net))
1130 return -EINVAL; 1130 return -EINVAL;
1131 1131
1132 ret = nlmsg_parse(nlh, sizeof(*dcb), tb, DCB_ATTR_MAX, 1132 ret = nlmsg_parse(nlh, sizeof(*dcb), tb, DCB_ATTR_MAX,
diff --git a/net/decnet/af_decnet.c b/net/decnet/af_decnet.c
index 9ade3a6de954..2b494fac9468 100644
--- a/net/decnet/af_decnet.c
+++ b/net/decnet/af_decnet.c
@@ -680,7 +680,7 @@ static int dn_create(struct net *net, struct socket *sock, int protocol,
680{ 680{
681 struct sock *sk; 681 struct sock *sk;
682 682
683 if (net != &init_net) 683 if (!net_eq(net, &init_net))
684 return -EAFNOSUPPORT; 684 return -EAFNOSUPPORT;
685 685
686 switch(sock->type) { 686 switch(sock->type) {
diff --git a/net/decnet/dn_dev.c b/net/decnet/dn_dev.c
index 6c916e2b8a84..f20dec9cfa06 100644
--- a/net/decnet/dn_dev.c
+++ b/net/decnet/dn_dev.c
@@ -636,7 +636,7 @@ static int dn_nl_deladdr(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg)
636 struct dn_ifaddr *ifa, **ifap; 636 struct dn_ifaddr *ifa, **ifap;
637 int err = -EINVAL; 637 int err = -EINVAL;
638 638
639 if (net != &init_net) 639 if (!net_eq(net, &init_net))
640 goto errout; 640 goto errout;
641 641
642 err = nlmsg_parse(nlh, sizeof(*ifm), tb, IFA_MAX, dn_ifa_policy); 642 err = nlmsg_parse(nlh, sizeof(*ifm), tb, IFA_MAX, dn_ifa_policy);
@@ -675,7 +675,7 @@ static int dn_nl_newaddr(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg)
675 struct dn_ifaddr *ifa; 675 struct dn_ifaddr *ifa;
676 int err; 676 int err;
677 677
678 if (net != &init_net) 678 if (!net_eq(net, &init_net))
679 return -EINVAL; 679 return -EINVAL;
680 680
681 err = nlmsg_parse(nlh, sizeof(*ifm), tb, IFA_MAX, dn_ifa_policy); 681 err = nlmsg_parse(nlh, sizeof(*ifm), tb, IFA_MAX, dn_ifa_policy);
@@ -789,7 +789,7 @@ static int dn_nl_dump_ifaddr(struct sk_buff *skb, struct netlink_callback *cb)
789 struct dn_dev *dn_db; 789 struct dn_dev *dn_db;
790 struct dn_ifaddr *ifa; 790 struct dn_ifaddr *ifa;
791 791
792 if (net != &init_net) 792 if (!net_eq(net, &init_net))
793 return 0; 793 return 0;
794 794
795 skip_ndevs = cb->args[0]; 795 skip_ndevs = cb->args[0];
diff --git a/net/decnet/dn_fib.c b/net/decnet/dn_fib.c
index fd641f65e092..e9d48700e83a 100644
--- a/net/decnet/dn_fib.c
+++ b/net/decnet/dn_fib.c
@@ -509,7 +509,7 @@ static int dn_fib_rtm_delroute(struct sk_buff *skb, struct nlmsghdr *nlh, void *
509 struct rtattr **rta = arg; 509 struct rtattr **rta = arg;
510 struct rtmsg *r = NLMSG_DATA(nlh); 510 struct rtmsg *r = NLMSG_DATA(nlh);
511 511
512 if (net != &init_net) 512 if (!net_eq(net, &init_net))
513 return -EINVAL; 513 return -EINVAL;
514 514
515 if (dn_fib_check_attr(r, rta)) 515 if (dn_fib_check_attr(r, rta))
@@ -529,7 +529,7 @@ static int dn_fib_rtm_newroute(struct sk_buff *skb, struct nlmsghdr *nlh, void *
529 struct rtattr **rta = arg; 529 struct rtattr **rta = arg;
530 struct rtmsg *r = NLMSG_DATA(nlh); 530 struct rtmsg *r = NLMSG_DATA(nlh);
531 531
532 if (net != &init_net) 532 if (!net_eq(net, &init_net))
533 return -EINVAL; 533 return -EINVAL;
534 534
535 if (dn_fib_check_attr(r, rta)) 535 if (dn_fib_check_attr(r, rta))
diff --git a/net/decnet/dn_route.c b/net/decnet/dn_route.c
index 860286a3921b..a03284061a31 100644
--- a/net/decnet/dn_route.c
+++ b/net/decnet/dn_route.c
@@ -1517,7 +1517,7 @@ static int dn_cache_getroute(struct sk_buff *in_skb, struct nlmsghdr *nlh, void
1517 struct sk_buff *skb; 1517 struct sk_buff *skb;
1518 struct flowi fl; 1518 struct flowi fl;
1519 1519
1520 if (net != &init_net) 1520 if (!net_eq(net, &init_net))
1521 return -EINVAL; 1521 return -EINVAL;
1522 1522
1523 memset(&fl, 0, sizeof(fl)); 1523 memset(&fl, 0, sizeof(fl));
@@ -1602,7 +1602,7 @@ int dn_cache_dump(struct sk_buff *skb, struct netlink_callback *cb)
1602 int h, s_h; 1602 int h, s_h;
1603 int idx, s_idx; 1603 int idx, s_idx;
1604 1604
1605 if (net != &init_net) 1605 if (!net_eq(net, &init_net))
1606 return 0; 1606 return 0;
1607 1607
1608 if (NLMSG_PAYLOAD(cb->nlh, 0) < sizeof(struct rtmsg)) 1608 if (NLMSG_PAYLOAD(cb->nlh, 0) < sizeof(struct rtmsg))
diff --git a/net/decnet/dn_table.c b/net/decnet/dn_table.c
index 67054b0d550f..f281e0f59b09 100644
--- a/net/decnet/dn_table.c
+++ b/net/decnet/dn_table.c
@@ -471,7 +471,7 @@ int dn_fib_dump(struct sk_buff *skb, struct netlink_callback *cb)
471 struct hlist_node *node; 471 struct hlist_node *node;
472 int dumped = 0; 472 int dumped = 0;
473 473
474 if (net != &init_net) 474 if (!net_eq(net, &init_net))
475 return 0; 475 return 0;
476 476
477 if (NLMSG_PAYLOAD(cb->nlh, 0) >= sizeof(struct rtmsg) && 477 if (NLMSG_PAYLOAD(cb->nlh, 0) >= sizeof(struct rtmsg) &&
diff --git a/net/econet/af_econet.c b/net/econet/af_econet.c
index 596679803de5..29b4931aae52 100644
--- a/net/econet/af_econet.c
+++ b/net/econet/af_econet.c
@@ -612,7 +612,7 @@ static int econet_create(struct net *net, struct socket *sock, int protocol,
612 struct econet_sock *eo; 612 struct econet_sock *eo;
613 int err; 613 int err;
614 614
615 if (net != &init_net) 615 if (!net_eq(net, &init_net))
616 return -EAFNOSUPPORT; 616 return -EAFNOSUPPORT;
617 617
618 /* Econet only provides datagram services. */ 618 /* Econet only provides datagram services. */
diff --git a/net/ieee802154/af_ieee802154.c b/net/ieee802154/af_ieee802154.c
index de6e34d2a7f8..bad1c49fd960 100644
--- a/net/ieee802154/af_ieee802154.c
+++ b/net/ieee802154/af_ieee802154.c
@@ -241,7 +241,7 @@ static int ieee802154_create(struct net *net, struct socket *sock,
241 struct proto *proto; 241 struct proto *proto;
242 const struct proto_ops *ops; 242 const struct proto_ops *ops;
243 243
244 if (net != &init_net) 244 if (!net_eq(net, &init_net))
245 return -EAFNOSUPPORT; 245 return -EAFNOSUPPORT;
246 246
247 switch (sock->type) { 247 switch (sock->type) {
diff --git a/net/ipv4/devinet.c b/net/ipv4/devinet.c
index 7620382058a0..c100709d6ddf 100644
--- a/net/ipv4/devinet.c
+++ b/net/ipv4/devinet.c
@@ -1605,7 +1605,7 @@ static __net_init int devinet_init_net(struct net *net)
1605 all = &ipv4_devconf; 1605 all = &ipv4_devconf;
1606 dflt = &ipv4_devconf_dflt; 1606 dflt = &ipv4_devconf_dflt;
1607 1607
1608 if (net != &init_net) { 1608 if (!net_eq(net, &init_net)) {
1609 all = kmemdup(all, sizeof(ipv4_devconf), GFP_KERNEL); 1609 all = kmemdup(all, sizeof(ipv4_devconf), GFP_KERNEL);
1610 if (all == NULL) 1610 if (all == NULL)
1611 goto err_alloc_all; 1611 goto err_alloc_all;
diff --git a/net/ipv4/fib_semantics.c b/net/ipv4/fib_semantics.c
index 9b096d6ff3f2..ed19aa6919c2 100644
--- a/net/ipv4/fib_semantics.c
+++ b/net/ipv4/fib_semantics.c
@@ -228,7 +228,7 @@ static struct fib_info *fib_find_info(const struct fib_info *nfi)
228 head = &fib_info_hash[hash]; 228 head = &fib_info_hash[hash];
229 229
230 hlist_for_each_entry(fi, node, head, fib_hash) { 230 hlist_for_each_entry(fi, node, head, fib_hash) {
231 if (fi->fib_net != nfi->fib_net) 231 if (!net_eq(fi->fib_net, nfi->fib_net))
232 continue; 232 continue;
233 if (fi->fib_nhs != nfi->fib_nhs) 233 if (fi->fib_nhs != nfi->fib_nhs)
234 continue; 234 continue;
@@ -1047,7 +1047,7 @@ int fib_sync_down_addr(struct net *net, __be32 local)
1047 return 0; 1047 return 0;
1048 1048
1049 hlist_for_each_entry(fi, node, head, fib_lhash) { 1049 hlist_for_each_entry(fi, node, head, fib_lhash) {
1050 if (fi->fib_net != net) 1050 if (!net_eq(fi->fib_net, net))
1051 continue; 1051 continue;
1052 if (fi->fib_prefsrc == local) { 1052 if (fi->fib_prefsrc == local) {
1053 fi->fib_flags |= RTNH_F_DEAD; 1053 fi->fib_flags |= RTNH_F_DEAD;
diff --git a/net/ipv4/inet_connection_sock.c b/net/ipv4/inet_connection_sock.c
index 26fb50e91311..9b35c56d1023 100644
--- a/net/ipv4/inet_connection_sock.c
+++ b/net/ipv4/inet_connection_sock.c
@@ -112,7 +112,7 @@ again:
112 hashinfo->bhash_size)]; 112 hashinfo->bhash_size)];
113 spin_lock(&head->lock); 113 spin_lock(&head->lock);
114 inet_bind_bucket_for_each(tb, node, &head->chain) 114 inet_bind_bucket_for_each(tb, node, &head->chain)
115 if (ib_net(tb) == net && tb->port == rover) { 115 if (net_eq(ib_net(tb), net) && tb->port == rover) {
116 if (tb->fastreuse > 0 && 116 if (tb->fastreuse > 0 &&
117 sk->sk_reuse && 117 sk->sk_reuse &&
118 sk->sk_state != TCP_LISTEN && 118 sk->sk_state != TCP_LISTEN &&
@@ -158,7 +158,7 @@ have_snum:
158 hashinfo->bhash_size)]; 158 hashinfo->bhash_size)];
159 spin_lock(&head->lock); 159 spin_lock(&head->lock);
160 inet_bind_bucket_for_each(tb, node, &head->chain) 160 inet_bind_bucket_for_each(tb, node, &head->chain)
161 if (ib_net(tb) == net && tb->port == snum) 161 if (net_eq(ib_net(tb), net) && tb->port == snum)
162 goto tb_found; 162 goto tb_found;
163 } 163 }
164 tb = NULL; 164 tb = NULL;
diff --git a/net/ipv4/inet_hashtables.c b/net/ipv4/inet_hashtables.c
index 47ad7aab51e3..94ef51aa5bc9 100644
--- a/net/ipv4/inet_hashtables.c
+++ b/net/ipv4/inet_hashtables.c
@@ -454,7 +454,8 @@ int __inet_hash_connect(struct inet_timewait_death_row *death_row,
454 * unique enough. 454 * unique enough.
455 */ 455 */
456 inet_bind_bucket_for_each(tb, node, &head->chain) { 456 inet_bind_bucket_for_each(tb, node, &head->chain) {
457 if (ib_net(tb) == net && tb->port == port) { 457 if (net_eq(ib_net(tb), net) &&
458 tb->port == port) {
458 if (tb->fastreuse >= 0) 459 if (tb->fastreuse >= 0)
459 goto next_port; 460 goto next_port;
460 WARN_ON(hlist_empty(&tb->owners)); 461 WARN_ON(hlist_empty(&tb->owners));
diff --git a/net/ipv4/ip_fragment.c b/net/ipv4/ip_fragment.c
index b007f8af6e1f..1472d8e3c191 100644
--- a/net/ipv4/ip_fragment.c
+++ b/net/ipv4/ip_fragment.c
@@ -658,7 +658,7 @@ static int ip4_frags_ns_ctl_register(struct net *net)
658 struct ctl_table_header *hdr; 658 struct ctl_table_header *hdr;
659 659
660 table = ip4_frags_ns_ctl_table; 660 table = ip4_frags_ns_ctl_table;
661 if (net != &init_net) { 661 if (!net_eq(net, &init_net)) {
662 table = kmemdup(table, sizeof(ip4_frags_ns_ctl_table), GFP_KERNEL); 662 table = kmemdup(table, sizeof(ip4_frags_ns_ctl_table), GFP_KERNEL);
663 if (table == NULL) 663 if (table == NULL)
664 goto err_alloc; 664 goto err_alloc;
@@ -676,7 +676,7 @@ static int ip4_frags_ns_ctl_register(struct net *net)
676 return 0; 676 return 0;
677 677
678err_reg: 678err_reg:
679 if (net != &init_net) 679 if (!net_eq(net, &init_net))
680 kfree(table); 680 kfree(table);
681err_alloc: 681err_alloc:
682 return -ENOMEM; 682 return -ENOMEM;
diff --git a/net/ipv4/ip_input.c b/net/ipv4/ip_input.c
index fdf51badc8e5..c29de9879fda 100644
--- a/net/ipv4/ip_input.c
+++ b/net/ipv4/ip_input.c
@@ -164,7 +164,7 @@ int ip_call_ra_chain(struct sk_buff *skb)
164 if (sk && inet_sk(sk)->inet_num == protocol && 164 if (sk && inet_sk(sk)->inet_num == protocol &&
165 (!sk->sk_bound_dev_if || 165 (!sk->sk_bound_dev_if ||
166 sk->sk_bound_dev_if == dev->ifindex) && 166 sk->sk_bound_dev_if == dev->ifindex) &&
167 sock_net(sk) == dev_net(dev)) { 167 net_eq(sock_net(sk), dev_net(dev))) {
168 if (ip_hdr(skb)->frag_off & htons(IP_MF | IP_OFFSET)) { 168 if (ip_hdr(skb)->frag_off & htons(IP_MF | IP_OFFSET)) {
169 if (ip_defrag(skb, IP_DEFRAG_CALL_RA_CHAIN)) { 169 if (ip_defrag(skb, IP_DEFRAG_CALL_RA_CHAIN)) {
170 read_unlock(&ip_ra_lock); 170 read_unlock(&ip_ra_lock);
diff --git a/net/ipv4/netfilter/ip_queue.c b/net/ipv4/netfilter/ip_queue.c
index c156db215987..884f0859cb3b 100644
--- a/net/ipv4/netfilter/ip_queue.c
+++ b/net/ipv4/netfilter/ip_queue.c
@@ -500,7 +500,7 @@ ipq_rcv_nl_event(struct notifier_block *this,
500 if (event == NETLINK_URELEASE && 500 if (event == NETLINK_URELEASE &&
501 n->protocol == NETLINK_FIREWALL && n->pid) { 501 n->protocol == NETLINK_FIREWALL && n->pid) {
502 write_lock_bh(&queue_lock); 502 write_lock_bh(&queue_lock);
503 if ((n->net == &init_net) && (n->pid == peer_pid)) 503 if ((net_eq(n->net, &init_net)) && (n->pid == peer_pid))
504 __ipq_reset(); 504 __ipq_reset();
505 write_unlock_bh(&queue_lock); 505 write_unlock_bh(&queue_lock);
506 } 506 }
diff --git a/net/ipv4/route.c b/net/ipv4/route.c
index 7547944ea9bf..aea7bb369cfa 100644
--- a/net/ipv4/route.c
+++ b/net/ipv4/route.c
@@ -703,7 +703,7 @@ static inline int compare_keys(struct flowi *fl1, struct flowi *fl2)
703 703
704static inline int compare_netns(struct rtable *rt1, struct rtable *rt2) 704static inline int compare_netns(struct rtable *rt1, struct rtable *rt2)
705{ 705{
706 return dev_net(rt1->u.dst.dev) == dev_net(rt2->u.dst.dev); 706 return net_eq(dev_net(rt1->u.dst.dev), dev_net(rt2->u.dst.dev));
707} 707}
708 708
709static inline int rt_is_expired(struct rtable *rth) 709static inline int rt_is_expired(struct rtable *rth)
@@ -3310,7 +3310,7 @@ static __net_init int sysctl_route_net_init(struct net *net)
3310 struct ctl_table *tbl; 3310 struct ctl_table *tbl;
3311 3311
3312 tbl = ipv4_route_flush_table; 3312 tbl = ipv4_route_flush_table;
3313 if (net != &init_net) { 3313 if (!net_eq(net, &init_net)) {
3314 tbl = kmemdup(tbl, sizeof(ipv4_route_flush_table), GFP_KERNEL); 3314 tbl = kmemdup(tbl, sizeof(ipv4_route_flush_table), GFP_KERNEL);
3315 if (tbl == NULL) 3315 if (tbl == NULL)
3316 goto err_dup; 3316 goto err_dup;
diff --git a/net/ipv4/sysctl_net_ipv4.c b/net/ipv4/sysctl_net_ipv4.c
index 2dcf04d9b005..c00323bae044 100644
--- a/net/ipv4/sysctl_net_ipv4.c
+++ b/net/ipv4/sysctl_net_ipv4.c
@@ -818,7 +818,7 @@ static __net_init int ipv4_sysctl_init_net(struct net *net)
818 struct ctl_table *table; 818 struct ctl_table *table;
819 819
820 table = ipv4_net_table; 820 table = ipv4_net_table;
821 if (net != &init_net) { 821 if (!net_eq(net, &init_net)) {
822 table = kmemdup(table, sizeof(ipv4_net_table), GFP_KERNEL); 822 table = kmemdup(table, sizeof(ipv4_net_table), GFP_KERNEL);
823 if (table == NULL) 823 if (table == NULL)
824 goto err_alloc; 824 goto err_alloc;
@@ -849,7 +849,7 @@ static __net_init int ipv4_sysctl_init_net(struct net *net)
849 return 0; 849 return 0;
850 850
851err_reg: 851err_reg:
852 if (net != &init_net) 852 if (!net_eq(net, &init_net))
853 kfree(table); 853 kfree(table);
854err_alloc: 854err_alloc:
855 return -ENOMEM; 855 return -ENOMEM;
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index 522bdc77206c..b1ce8fc62049 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -4498,7 +4498,7 @@ static int addrconf_init_net(struct net *net)
4498 all = &ipv6_devconf; 4498 all = &ipv6_devconf;
4499 dflt = &ipv6_devconf_dflt; 4499 dflt = &ipv6_devconf_dflt;
4500 4500
4501 if (net != &init_net) { 4501 if (!net_eq(net, &init_net)) {
4502 all = kmemdup(all, sizeof(ipv6_devconf), GFP_KERNEL); 4502 all = kmemdup(all, sizeof(ipv6_devconf), GFP_KERNEL);
4503 if (all == NULL) 4503 if (all == NULL)
4504 goto err_alloc_all; 4504 goto err_alloc_all;
@@ -4546,7 +4546,7 @@ static void addrconf_exit_net(struct net *net)
4546 __addrconf_sysctl_unregister(net->ipv6.devconf_dflt); 4546 __addrconf_sysctl_unregister(net->ipv6.devconf_dflt);
4547 __addrconf_sysctl_unregister(net->ipv6.devconf_all); 4547 __addrconf_sysctl_unregister(net->ipv6.devconf_all);
4548#endif 4548#endif
4549 if (net != &init_net) { 4549 if (!net_eq(net, &init_net)) {
4550 kfree(net->ipv6.devconf_dflt); 4550 kfree(net->ipv6.devconf_dflt);
4551 kfree(net->ipv6.devconf_all); 4551 kfree(net->ipv6.devconf_all);
4552 } 4552 }
diff --git a/net/ipv6/ip6_flowlabel.c b/net/ipv6/ip6_flowlabel.c
index 593a67e8d3f6..6e7bffa2205e 100644
--- a/net/ipv6/ip6_flowlabel.c
+++ b/net/ipv6/ip6_flowlabel.c
@@ -67,7 +67,7 @@ static inline struct ip6_flowlabel *__fl_lookup(struct net *net, __be32 label)
67 struct ip6_flowlabel *fl; 67 struct ip6_flowlabel *fl;
68 68
69 for (fl=fl_ht[FL_HASH(label)]; fl; fl = fl->next) { 69 for (fl=fl_ht[FL_HASH(label)]; fl; fl = fl->next) {
70 if (fl->label == label && fl->fl_net == net) 70 if (fl->label == label && net_eq(fl->fl_net, net))
71 return fl; 71 return fl;
72 } 72 }
73 return NULL; 73 return NULL;
@@ -163,7 +163,8 @@ static void ip6_fl_purge(struct net *net)
163 struct ip6_flowlabel *fl, **flp; 163 struct ip6_flowlabel *fl, **flp;
164 flp = &fl_ht[i]; 164 flp = &fl_ht[i];
165 while ((fl = *flp) != NULL) { 165 while ((fl = *flp) != NULL) {
166 if (fl->fl_net == net && atomic_read(&fl->users) == 0) { 166 if (net_eq(fl->fl_net, net) &&
167 atomic_read(&fl->users) == 0) {
167 *flp = fl->next; 168 *flp = fl->next;
168 fl_free(fl); 169 fl_free(fl);
169 atomic_dec(&fl_size); 170 atomic_dec(&fl_size);
@@ -630,7 +631,7 @@ static struct ip6_flowlabel *ip6fl_get_first(struct seq_file *seq)
630 for (state->bucket = 0; state->bucket <= FL_HASH_MASK; ++state->bucket) { 631 for (state->bucket = 0; state->bucket <= FL_HASH_MASK; ++state->bucket) {
631 fl = fl_ht[state->bucket]; 632 fl = fl_ht[state->bucket];
632 633
633 while (fl && fl->fl_net != net) 634 while (fl && !net_eq(fl->fl_net, net))
634 fl = fl->next; 635 fl = fl->next;
635 if (fl) 636 if (fl)
636 break; 637 break;
@@ -645,7 +646,7 @@ static struct ip6_flowlabel *ip6fl_get_next(struct seq_file *seq, struct ip6_flo
645 646
646 fl = fl->next; 647 fl = fl->next;
647try_again: 648try_again:
648 while (fl && fl->fl_net != net) 649 while (fl && !net_eq(fl->fl_net, net))
649 fl = fl->next; 650 fl = fl->next;
650 651
651 while (!fl) { 652 while (!fl) {
diff --git a/net/ipv6/netfilter/ip6_queue.c b/net/ipv6/netfilter/ip6_queue.c
index 1cf3f0c6a959..4c7a18abcaff 100644
--- a/net/ipv6/netfilter/ip6_queue.c
+++ b/net/ipv6/netfilter/ip6_queue.c
@@ -502,7 +502,7 @@ ipq_rcv_nl_event(struct notifier_block *this,
502 if (event == NETLINK_URELEASE && 502 if (event == NETLINK_URELEASE &&
503 n->protocol == NETLINK_IP6_FW && n->pid) { 503 n->protocol == NETLINK_IP6_FW && n->pid) {
504 write_lock_bh(&queue_lock); 504 write_lock_bh(&queue_lock);
505 if ((n->net == &init_net) && (n->pid == peer_pid)) 505 if ((net_eq(n->net, &init_net)) && (n->pid == peer_pid))
506 __ipq_reset(); 506 __ipq_reset();
507 write_unlock_bh(&queue_lock); 507 write_unlock_bh(&queue_lock);
508 } 508 }
diff --git a/net/ipv6/reassembly.c b/net/ipv6/reassembly.c
index dce699fb2672..45efc39753e2 100644
--- a/net/ipv6/reassembly.c
+++ b/net/ipv6/reassembly.c
@@ -681,7 +681,7 @@ static int ip6_frags_ns_sysctl_register(struct net *net)
681 struct ctl_table_header *hdr; 681 struct ctl_table_header *hdr;
682 682
683 table = ip6_frags_ns_ctl_table; 683 table = ip6_frags_ns_ctl_table;
684 if (net != &init_net) { 684 if (!net_eq(net, &init_net)) {
685 table = kmemdup(table, sizeof(ip6_frags_ns_ctl_table), GFP_KERNEL); 685 table = kmemdup(table, sizeof(ip6_frags_ns_ctl_table), GFP_KERNEL);
686 if (table == NULL) 686 if (table == NULL)
687 goto err_alloc; 687 goto err_alloc;
@@ -699,7 +699,7 @@ static int ip6_frags_ns_sysctl_register(struct net *net)
699 return 0; 699 return 0;
700 700
701err_reg: 701err_reg:
702 if (net != &init_net) 702 if (!net_eq(net, &init_net))
703 kfree(table); 703 kfree(table);
704err_alloc: 704err_alloc:
705 return -ENOMEM; 705 return -ENOMEM;
diff --git a/net/ipx/af_ipx.c b/net/ipx/af_ipx.c
index 975c5a366e55..f9759b54a6de 100644
--- a/net/ipx/af_ipx.c
+++ b/net/ipx/af_ipx.c
@@ -1362,7 +1362,7 @@ static int ipx_create(struct net *net, struct socket *sock, int protocol,
1362 int rc = -ESOCKTNOSUPPORT; 1362 int rc = -ESOCKTNOSUPPORT;
1363 struct sock *sk; 1363 struct sock *sk;
1364 1364
1365 if (net != &init_net) 1365 if (!net_eq(net, &init_net))
1366 return -EAFNOSUPPORT; 1366 return -EAFNOSUPPORT;
1367 1367
1368 /* 1368 /*
diff --git a/net/llc/af_llc.c b/net/llc/af_llc.c
index 5266c286b260..3a66546cad06 100644
--- a/net/llc/af_llc.c
+++ b/net/llc/af_llc.c
@@ -158,7 +158,7 @@ static int llc_ui_create(struct net *net, struct socket *sock, int protocol,
158 if (!capable(CAP_NET_RAW)) 158 if (!capable(CAP_NET_RAW))
159 return -EPERM; 159 return -EPERM;
160 160
161 if (net != &init_net) 161 if (!net_eq(net, &init_net))
162 return -EAFNOSUPPORT; 162 return -EAFNOSUPPORT;
163 163
164 if (likely(sock->type == SOCK_DGRAM || sock->type == SOCK_STREAM)) { 164 if (likely(sock->type == SOCK_DGRAM || sock->type == SOCK_STREAM)) {
diff --git a/net/netfilter/nfnetlink_log.c b/net/netfilter/nfnetlink_log.c
index f900dc3194af..49005482e39a 100644
--- a/net/netfilter/nfnetlink_log.c
+++ b/net/netfilter/nfnetlink_log.c
@@ -678,7 +678,7 @@ nfulnl_rcv_nl_event(struct notifier_block *this,
678 struct hlist_head *head = &instance_table[i]; 678 struct hlist_head *head = &instance_table[i];
679 679
680 hlist_for_each_entry_safe(inst, tmp, t2, head, hlist) { 680 hlist_for_each_entry_safe(inst, tmp, t2, head, hlist) {
681 if ((n->net == &init_net) && 681 if ((net_eq(n->net, &init_net)) &&
682 (n->pid == inst->peer_pid)) 682 (n->pid == inst->peer_pid))
683 __instance_destroy(inst); 683 __instance_destroy(inst);
684 } 684 }
diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c
index eff5b0ddc5ca..a4957bf2ca60 100644
--- a/net/netlink/af_netlink.c
+++ b/net/netlink/af_netlink.c
@@ -1092,7 +1092,7 @@ static inline int do_one_set_err(struct sock *sk,
1092 if (sk == p->exclude_sk) 1092 if (sk == p->exclude_sk)
1093 goto out; 1093 goto out;
1094 1094
1095 if (sock_net(sk) != sock_net(p->exclude_sk)) 1095 if (!net_eq(sock_net(sk), sock_net(p->exclude_sk)))
1096 goto out; 1096 goto out;
1097 1097
1098 if (nlk->pid == p->pid || p->group - 1 >= nlk->ngroups || 1098 if (nlk->pid == p->pid || p->group - 1 >= nlk->ngroups ||
diff --git a/net/netrom/af_netrom.c b/net/netrom/af_netrom.c
index 4bdd5697f63b..71604c6613b5 100644
--- a/net/netrom/af_netrom.c
+++ b/net/netrom/af_netrom.c
@@ -431,7 +431,7 @@ static int nr_create(struct net *net, struct socket *sock, int protocol,
431 struct sock *sk; 431 struct sock *sk;
432 struct nr_sock *nr; 432 struct nr_sock *nr;
433 433
434 if (net != &init_net) 434 if (!net_eq(net, &init_net))
435 return -EAFNOSUPPORT; 435 return -EAFNOSUPPORT;
436 436
437 if (sock->type != SOCK_SEQPACKET || protocol != 0) 437 if (sock->type != SOCK_SEQPACKET || protocol != 0)
diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c
index c620bd9ae3de..940fc20b2b50 100644
--- a/net/packet/af_packet.c
+++ b/net/packet/af_packet.c
@@ -365,7 +365,7 @@ static int packet_rcv_spkt(struct sk_buff *skb, struct net_device *dev,
365 if (skb->pkt_type == PACKET_LOOPBACK) 365 if (skb->pkt_type == PACKET_LOOPBACK)
366 goto out; 366 goto out;
367 367
368 if (dev_net(dev) != sock_net(sk)) 368 if (!net_eq(dev_net(dev), sock_net(sk)))
369 goto out; 369 goto out;
370 370
371 skb = skb_share_check(skb, GFP_ATOMIC); 371 skb = skb_share_check(skb, GFP_ATOMIC);
@@ -553,7 +553,7 @@ static int packet_rcv(struct sk_buff *skb, struct net_device *dev,
553 sk = pt->af_packet_priv; 553 sk = pt->af_packet_priv;
554 po = pkt_sk(sk); 554 po = pkt_sk(sk);
555 555
556 if (dev_net(dev) != sock_net(sk)) 556 if (!net_eq(dev_net(dev), sock_net(sk)))
557 goto drop; 557 goto drop;
558 558
559 skb->dev = dev; 559 skb->dev = dev;
@@ -674,7 +674,7 @@ static int tpacket_rcv(struct sk_buff *skb, struct net_device *dev,
674 sk = pt->af_packet_priv; 674 sk = pt->af_packet_priv;
675 po = pkt_sk(sk); 675 po = pkt_sk(sk);
676 676
677 if (dev_net(dev) != sock_net(sk)) 677 if (!net_eq(dev_net(dev), sock_net(sk)))
678 goto drop; 678 goto drop;
679 679
680 if (dev->header_ops) { 680 if (dev->header_ops) {
diff --git a/net/rose/af_rose.c b/net/rose/af_rose.c
index 4de4287fec37..8feb9e5d6623 100644
--- a/net/rose/af_rose.c
+++ b/net/rose/af_rose.c
@@ -518,7 +518,7 @@ static int rose_create(struct net *net, struct socket *sock, int protocol,
518 struct sock *sk; 518 struct sock *sk;
519 struct rose_sock *rose; 519 struct rose_sock *rose;
520 520
521 if (net != &init_net) 521 if (!net_eq(net, &init_net))
522 return -EAFNOSUPPORT; 522 return -EAFNOSUPPORT;
523 523
524 if (sock->type != SOCK_SEQPACKET || protocol != 0) 524 if (sock->type != SOCK_SEQPACKET || protocol != 0)
diff --git a/net/rxrpc/af_rxrpc.c b/net/rxrpc/af_rxrpc.c
index f978d02a248a..287b1415cee9 100644
--- a/net/rxrpc/af_rxrpc.c
+++ b/net/rxrpc/af_rxrpc.c
@@ -616,7 +616,7 @@ static int rxrpc_create(struct net *net, struct socket *sock, int protocol,
616 616
617 _enter("%p,%d", sock, protocol); 617 _enter("%p,%d", sock, protocol);
618 618
619 if (net != &init_net) 619 if (!net_eq(net, &init_net))
620 return -EAFNOSUPPORT; 620 return -EAFNOSUPPORT;
621 621
622 /* we support transport protocol UDP only */ 622 /* we support transport protocol UDP only */
diff --git a/net/sched/act_api.c b/net/sched/act_api.c
index ca2e1fd2bf69..2a740035aa6b 100644
--- a/net/sched/act_api.c
+++ b/net/sched/act_api.c
@@ -969,7 +969,7 @@ static int tc_ctl_action(struct sk_buff *skb, struct nlmsghdr *n, void *arg)
969 u32 pid = skb ? NETLINK_CB(skb).pid : 0; 969 u32 pid = skb ? NETLINK_CB(skb).pid : 0;
970 int ret = 0, ovr = 0; 970 int ret = 0, ovr = 0;
971 971
972 if (net != &init_net) 972 if (!net_eq(net, &init_net))
973 return -EINVAL; 973 return -EINVAL;
974 974
975 ret = nlmsg_parse(n, sizeof(struct tcamsg), tca, TCA_ACT_MAX, NULL); 975 ret = nlmsg_parse(n, sizeof(struct tcamsg), tca, TCA_ACT_MAX, NULL);
@@ -1052,7 +1052,7 @@ tc_dump_action(struct sk_buff *skb, struct netlink_callback *cb)
1052 struct tcamsg *t = (struct tcamsg *) NLMSG_DATA(cb->nlh); 1052 struct tcamsg *t = (struct tcamsg *) NLMSG_DATA(cb->nlh);
1053 struct nlattr *kind = find_dump_kind(cb->nlh); 1053 struct nlattr *kind = find_dump_kind(cb->nlh);
1054 1054
1055 if (net != &init_net) 1055 if (!net_eq(net, &init_net))
1056 return 0; 1056 return 0;
1057 1057
1058 if (kind == NULL) { 1058 if (kind == NULL) {
diff --git a/net/sched/cls_api.c b/net/sched/cls_api.c
index c024da77824f..3725d8fa29db 100644
--- a/net/sched/cls_api.c
+++ b/net/sched/cls_api.c
@@ -137,7 +137,7 @@ static int tc_ctl_tfilter(struct sk_buff *skb, struct nlmsghdr *n, void *arg)
137 int err; 137 int err;
138 int tp_created = 0; 138 int tp_created = 0;
139 139
140 if (net != &init_net) 140 if (!net_eq(net, &init_net))
141 return -EINVAL; 141 return -EINVAL;
142 142
143replay: 143replay:
@@ -418,7 +418,7 @@ static int tc_dump_tfilter(struct sk_buff *skb, struct netlink_callback *cb)
418 const struct Qdisc_class_ops *cops; 418 const struct Qdisc_class_ops *cops;
419 struct tcf_dump_args arg; 419 struct tcf_dump_args arg;
420 420
421 if (net != &init_net) 421 if (!net_eq(net, &init_net))
422 return 0; 422 return 0;
423 423
424 if (cb->nlh->nlmsg_len < NLMSG_LENGTH(sizeof(*tcm))) 424 if (cb->nlh->nlmsg_len < NLMSG_LENGTH(sizeof(*tcm)))
diff --git a/net/sched/sch_api.c b/net/sched/sch_api.c
index 876ba4bb6ae9..75fd1c672c61 100644
--- a/net/sched/sch_api.c
+++ b/net/sched/sch_api.c
@@ -947,7 +947,7 @@ static int tc_get_qdisc(struct sk_buff *skb, struct nlmsghdr *n, void *arg)
947 struct Qdisc *p = NULL; 947 struct Qdisc *p = NULL;
948 int err; 948 int err;
949 949
950 if (net != &init_net) 950 if (!net_eq(net, &init_net))
951 return -EINVAL; 951 return -EINVAL;
952 952
953 if ((dev = __dev_get_by_index(&init_net, tcm->tcm_ifindex)) == NULL) 953 if ((dev = __dev_get_by_index(&init_net, tcm->tcm_ifindex)) == NULL)
@@ -1009,7 +1009,7 @@ static int tc_modify_qdisc(struct sk_buff *skb, struct nlmsghdr *n, void *arg)
1009 struct Qdisc *q, *p; 1009 struct Qdisc *q, *p;
1010 int err; 1010 int err;
1011 1011
1012 if (net != &init_net) 1012 if (!net_eq(net, &init_net))
1013 return -EINVAL; 1013 return -EINVAL;
1014 1014
1015replay: 1015replay:
@@ -1274,7 +1274,7 @@ static int tc_dump_qdisc(struct sk_buff *skb, struct netlink_callback *cb)
1274 int s_idx, s_q_idx; 1274 int s_idx, s_q_idx;
1275 struct net_device *dev; 1275 struct net_device *dev;
1276 1276
1277 if (net != &init_net) 1277 if (!net_eq(net, &init_net))
1278 return 0; 1278 return 0;
1279 1279
1280 s_idx = cb->args[0]; 1280 s_idx = cb->args[0];
@@ -1334,7 +1334,7 @@ static int tc_ctl_tclass(struct sk_buff *skb, struct nlmsghdr *n, void *arg)
1334 u32 qid = TC_H_MAJ(clid); 1334 u32 qid = TC_H_MAJ(clid);
1335 int err; 1335 int err;
1336 1336
1337 if (net != &init_net) 1337 if (!net_eq(net, &init_net))
1338 return -EINVAL; 1338 return -EINVAL;
1339 1339
1340 if ((dev = __dev_get_by_index(&init_net, tcm->tcm_ifindex)) == NULL) 1340 if ((dev = __dev_get_by_index(&init_net, tcm->tcm_ifindex)) == NULL)
@@ -1576,7 +1576,7 @@ static int tc_dump_tclass(struct sk_buff *skb, struct netlink_callback *cb)
1576 struct net_device *dev; 1576 struct net_device *dev;
1577 int t, s_t; 1577 int t, s_t;
1578 1578
1579 if (net != &init_net) 1579 if (!net_eq(net, &init_net))
1580 return 0; 1580 return 0;
1581 1581
1582 if (cb->nlh->nlmsg_len < NLMSG_LENGTH(sizeof(*tcm))) 1582 if (cb->nlh->nlmsg_len < NLMSG_LENGTH(sizeof(*tcm)))
diff --git a/net/tipc/socket.c b/net/tipc/socket.c
index d00c2119faf3..eca5eb0dab08 100644
--- a/net/tipc/socket.c
+++ b/net/tipc/socket.c
@@ -195,7 +195,7 @@ static int tipc_create(struct net *net, struct socket *sock, int protocol,
195 195
196 /* Validate arguments */ 196 /* Validate arguments */
197 197
198 if (net != &init_net) 198 if (!net_eq(net, &init_net))
199 return -EAFNOSUPPORT; 199 return -EAFNOSUPPORT;
200 200
201 if (unlikely(protocol != 0)) 201 if (unlikely(protocol != 0))
diff --git a/net/x25/af_x25.c b/net/x25/af_x25.c
index ac7dba46fa33..2a3a513af3cb 100644
--- a/net/x25/af_x25.c
+++ b/net/x25/af_x25.c
@@ -514,7 +514,7 @@ static int x25_create(struct net *net, struct socket *sock, int protocol,
514 struct x25_sock *x25; 514 struct x25_sock *x25;
515 int rc = -ESOCKTNOSUPPORT; 515 int rc = -ESOCKTNOSUPPORT;
516 516
517 if (net != &init_net) 517 if (!net_eq(net, &init_net))
518 return -EAFNOSUPPORT; 518 return -EAFNOSUPPORT;
519 519
520 if (sock->type != SOCK_SEQPACKET || protocol) 520 if (sock->type != SOCK_SEQPACKET || protocol)