diff options
-rw-r--r-- | drivers/block/aoe/aoenet.c | 4 | ||||
-rw-r--r-- | drivers/net/bonding/bond_3ad.c | 4 | ||||
-rw-r--r-- | drivers/net/bonding/bond_alb.c | 3 | ||||
-rw-r--r-- | drivers/net/bonding/bond_main.c | 3 | ||||
-rw-r--r-- | drivers/net/hamradio/bpqether.c | 3 | ||||
-rw-r--r-- | drivers/net/pppoe.c | 6 | ||||
-rw-r--r-- | drivers/net/wan/hdlc.c | 7 | ||||
-rw-r--r-- | drivers/net/wan/lapbether.c | 3 | ||||
-rw-r--r-- | drivers/net/wan/syncppp.c | 6 | ||||
-rw-r--r-- | net/8021q/vlan_dev.c | 5 | ||||
-rw-r--r-- | net/appletalk/aarp.c | 3 | ||||
-rw-r--r-- | net/appletalk/ddp.c | 6 | ||||
-rw-r--r-- | net/ax25/ax25_in.c | 5 | ||||
-rw-r--r-- | net/bridge/br_stp_bpdu.c | 4 | ||||
-rw-r--r-- | net/decnet/dn_route.c | 3 | ||||
-rw-r--r-- | net/econet/af_econet.c | 3 | ||||
-rw-r--r-- | net/ipv4/arp.c | 3 | ||||
-rw-r--r-- | net/ipv4/ip_input.c | 3 | ||||
-rw-r--r-- | net/ipv4/ipconfig.c | 6 | ||||
-rw-r--r-- | net/ipv6/ip6_input.c | 5 | ||||
-rw-r--r-- | net/ipx/af_ipx.c | 3 | ||||
-rw-r--r-- | net/irda/irlap_frame.c | 3 | ||||
-rw-r--r-- | net/llc/llc_input.c | 4 | ||||
-rw-r--r-- | net/packet/af_packet.c | 9 | ||||
-rw-r--r-- | net/tipc/eth_media.c | 6 | ||||
-rw-r--r-- | net/x25/x25_dev.c | 3 |
26 files changed, 113 insertions, 0 deletions
diff --git a/drivers/block/aoe/aoenet.c b/drivers/block/aoe/aoenet.c index f9ddfda4d9cb..4dc0fb7da94b 100644 --- a/drivers/block/aoe/aoenet.c +++ b/drivers/block/aoe/aoenet.c | |||
@@ -8,6 +8,7 @@ | |||
8 | #include <linux/blkdev.h> | 8 | #include <linux/blkdev.h> |
9 | #include <linux/netdevice.h> | 9 | #include <linux/netdevice.h> |
10 | #include <linux/moduleparam.h> | 10 | #include <linux/moduleparam.h> |
11 | #include <net/net_namespace.h> | ||
11 | #include <asm/unaligned.h> | 12 | #include <asm/unaligned.h> |
12 | #include "aoe.h" | 13 | #include "aoe.h" |
13 | 14 | ||
@@ -114,6 +115,9 @@ aoenet_rcv(struct sk_buff *skb, struct net_device *ifp, struct packet_type *pt, | |||
114 | struct aoe_hdr *h; | 115 | struct aoe_hdr *h; |
115 | u32 n; | 116 | u32 n; |
116 | 117 | ||
118 | if (ifp->nd_net != &init_net) | ||
119 | goto exit; | ||
120 | |||
117 | skb = skb_share_check(skb, GFP_ATOMIC); | 121 | skb = skb_share_check(skb, GFP_ATOMIC); |
118 | if (skb == NULL) | 122 | if (skb == NULL) |
119 | return 0; | 123 | return 0; |
diff --git a/drivers/net/bonding/bond_3ad.c b/drivers/net/bonding/bond_3ad.c index f829e4ad8b49..94bd73941451 100644 --- a/drivers/net/bonding/bond_3ad.c +++ b/drivers/net/bonding/bond_3ad.c | |||
@@ -29,6 +29,7 @@ | |||
29 | #include <linux/ethtool.h> | 29 | #include <linux/ethtool.h> |
30 | #include <linux/if_bonding.h> | 30 | #include <linux/if_bonding.h> |
31 | #include <linux/pkt_sched.h> | 31 | #include <linux/pkt_sched.h> |
32 | #include <net/net_namespace.h> | ||
32 | #include "bonding.h" | 33 | #include "bonding.h" |
33 | #include "bond_3ad.h" | 34 | #include "bond_3ad.h" |
34 | 35 | ||
@@ -2448,6 +2449,9 @@ int bond_3ad_lacpdu_recv(struct sk_buff *skb, struct net_device *dev, struct pac | |||
2448 | struct slave *slave = NULL; | 2449 | struct slave *slave = NULL; |
2449 | int ret = NET_RX_DROP; | 2450 | int ret = NET_RX_DROP; |
2450 | 2451 | ||
2452 | if (dev->nd_net != &init_net) | ||
2453 | goto out; | ||
2454 | |||
2451 | if (!(dev->flags & IFF_MASTER)) | 2455 | if (!(dev->flags & IFF_MASTER)) |
2452 | goto out; | 2456 | goto out; |
2453 | 2457 | ||
diff --git a/drivers/net/bonding/bond_alb.c b/drivers/net/bonding/bond_alb.c index 92c3b6f6a8e7..419a9f8fdd53 100644 --- a/drivers/net/bonding/bond_alb.c +++ b/drivers/net/bonding/bond_alb.c | |||
@@ -345,6 +345,9 @@ static int rlb_arp_recv(struct sk_buff *skb, struct net_device *bond_dev, struct | |||
345 | struct arp_pkt *arp = (struct arp_pkt *)skb->data; | 345 | struct arp_pkt *arp = (struct arp_pkt *)skb->data; |
346 | int res = NET_RX_DROP; | 346 | int res = NET_RX_DROP; |
347 | 347 | ||
348 | if (bond_dev->nd_net != &init_net) | ||
349 | goto out; | ||
350 | |||
348 | if (!(bond_dev->flags & IFF_MASTER)) | 351 | if (!(bond_dev->flags & IFF_MASTER)) |
349 | goto out; | 352 | goto out; |
350 | 353 | ||
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c index 5de648f90a45..e4e5fdc0430b 100644 --- a/drivers/net/bonding/bond_main.c +++ b/drivers/net/bonding/bond_main.c | |||
@@ -2458,6 +2458,9 @@ static int bond_arp_rcv(struct sk_buff *skb, struct net_device *dev, struct pack | |||
2458 | unsigned char *arp_ptr; | 2458 | unsigned char *arp_ptr; |
2459 | u32 sip, tip; | 2459 | u32 sip, tip; |
2460 | 2460 | ||
2461 | if (dev->nd_net != &init_net) | ||
2462 | goto out; | ||
2463 | |||
2461 | if (!(dev->priv_flags & IFF_BONDING) || !(dev->flags & IFF_MASTER)) | 2464 | if (!(dev->priv_flags & IFF_BONDING) || !(dev->flags & IFF_MASTER)) |
2462 | goto out; | 2465 | goto out; |
2463 | 2466 | ||
diff --git a/drivers/net/hamradio/bpqether.c b/drivers/net/hamradio/bpqether.c index 1699d42d13ca..85fb8e7efacf 100644 --- a/drivers/net/hamradio/bpqether.c +++ b/drivers/net/hamradio/bpqether.c | |||
@@ -173,6 +173,9 @@ static int bpq_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_ty | |||
173 | struct ethhdr *eth; | 173 | struct ethhdr *eth; |
174 | struct bpqdev *bpq; | 174 | struct bpqdev *bpq; |
175 | 175 | ||
176 | if (dev->nd_net != &init_net) | ||
177 | goto drop; | ||
178 | |||
176 | if ((skb = skb_share_check(skb, GFP_ATOMIC)) == NULL) | 179 | if ((skb = skb_share_check(skb, GFP_ATOMIC)) == NULL) |
177 | return NET_RX_DROP; | 180 | return NET_RX_DROP; |
178 | 181 | ||
diff --git a/drivers/net/pppoe.c b/drivers/net/pppoe.c index 53fcee26d6ae..60c0e4e17875 100644 --- a/drivers/net/pppoe.c +++ b/drivers/net/pppoe.c | |||
@@ -389,6 +389,9 @@ static int pppoe_rcv(struct sk_buff *skb, | |||
389 | if (!(skb = skb_share_check(skb, GFP_ATOMIC))) | 389 | if (!(skb = skb_share_check(skb, GFP_ATOMIC))) |
390 | goto out; | 390 | goto out; |
391 | 391 | ||
392 | if (dev->nd_net != &init_net) | ||
393 | goto drop; | ||
394 | |||
392 | if (!pskb_may_pull(skb, sizeof(struct pppoe_hdr))) | 395 | if (!pskb_may_pull(skb, sizeof(struct pppoe_hdr))) |
393 | goto drop; | 396 | goto drop; |
394 | 397 | ||
@@ -418,6 +421,9 @@ static int pppoe_disc_rcv(struct sk_buff *skb, | |||
418 | struct pppoe_hdr *ph; | 421 | struct pppoe_hdr *ph; |
419 | struct pppox_sock *po; | 422 | struct pppox_sock *po; |
420 | 423 | ||
424 | if (dev->nd_net != &init_net) | ||
425 | goto abort; | ||
426 | |||
421 | if (!pskb_may_pull(skb, sizeof(struct pppoe_hdr))) | 427 | if (!pskb_may_pull(skb, sizeof(struct pppoe_hdr))) |
422 | goto abort; | 428 | goto abort; |
423 | 429 | ||
diff --git a/drivers/net/wan/hdlc.c b/drivers/net/wan/hdlc.c index 65ad2e24caf0..3b57350eacca 100644 --- a/drivers/net/wan/hdlc.c +++ b/drivers/net/wan/hdlc.c | |||
@@ -36,6 +36,7 @@ | |||
36 | #include <linux/rtnetlink.h> | 36 | #include <linux/rtnetlink.h> |
37 | #include <linux/notifier.h> | 37 | #include <linux/notifier.h> |
38 | #include <linux/hdlc.h> | 38 | #include <linux/hdlc.h> |
39 | #include <net/net_namespace.h> | ||
39 | 40 | ||
40 | 41 | ||
41 | static const char* version = "HDLC support module revision 1.21"; | 42 | static const char* version = "HDLC support module revision 1.21"; |
@@ -66,6 +67,12 @@ static int hdlc_rcv(struct sk_buff *skb, struct net_device *dev, | |||
66 | struct packet_type *p, struct net_device *orig_dev) | 67 | struct packet_type *p, struct net_device *orig_dev) |
67 | { | 68 | { |
68 | struct hdlc_device_desc *desc = dev_to_desc(dev); | 69 | struct hdlc_device_desc *desc = dev_to_desc(dev); |
70 | |||
71 | if (dev->nd_net != &init_net) { | ||
72 | kfree_skb(skb); | ||
73 | return 0; | ||
74 | } | ||
75 | |||
69 | if (desc->netif_rx) | 76 | if (desc->netif_rx) |
70 | return desc->netif_rx(skb); | 77 | return desc->netif_rx(skb); |
71 | 78 | ||
diff --git a/drivers/net/wan/lapbether.c b/drivers/net/wan/lapbether.c index 6c302e9dbca2..ca8b3c3cb931 100644 --- a/drivers/net/wan/lapbether.c +++ b/drivers/net/wan/lapbether.c | |||
@@ -91,6 +91,9 @@ static int lapbeth_rcv(struct sk_buff *skb, struct net_device *dev, struct packe | |||
91 | int len, err; | 91 | int len, err; |
92 | struct lapbethdev *lapbeth; | 92 | struct lapbethdev *lapbeth; |
93 | 93 | ||
94 | if (dev->nd_net != &init_net) | ||
95 | goto drop; | ||
96 | |||
94 | if ((skb = skb_share_check(skb, GFP_ATOMIC)) == NULL) | 97 | if ((skb = skb_share_check(skb, GFP_ATOMIC)) == NULL) |
95 | return NET_RX_DROP; | 98 | return NET_RX_DROP; |
96 | 99 | ||
diff --git a/drivers/net/wan/syncppp.c b/drivers/net/wan/syncppp.c index 67fc67cfd452..5c71af6ea3a5 100644 --- a/drivers/net/wan/syncppp.c +++ b/drivers/net/wan/syncppp.c | |||
@@ -51,6 +51,7 @@ | |||
51 | #include <linux/spinlock.h> | 51 | #include <linux/spinlock.h> |
52 | #include <linux/rcupdate.h> | 52 | #include <linux/rcupdate.h> |
53 | 53 | ||
54 | #include <net/net_namespace.h> | ||
54 | #include <net/syncppp.h> | 55 | #include <net/syncppp.h> |
55 | 56 | ||
56 | #include <asm/byteorder.h> | 57 | #include <asm/byteorder.h> |
@@ -1445,6 +1446,11 @@ static void sppp_print_bytes (u_char *p, u16 len) | |||
1445 | 1446 | ||
1446 | static int sppp_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_type *p, struct net_device *orig_dev) | 1447 | static int sppp_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_type *p, struct net_device *orig_dev) |
1447 | { | 1448 | { |
1449 | if (dev->nd_net != &init_net) { | ||
1450 | kfree_skb(skb); | ||
1451 | return 0; | ||
1452 | } | ||
1453 | |||
1448 | if ((skb = skb_share_check(skb, GFP_ATOMIC)) == NULL) | 1454 | if ((skb = skb_share_check(skb, GFP_ATOMIC)) == NULL) |
1449 | return NET_RX_DROP; | 1455 | return NET_RX_DROP; |
1450 | sppp_input(dev,skb); | 1456 | sppp_input(dev,skb); |
diff --git a/net/8021q/vlan_dev.c b/net/8021q/vlan_dev.c index 328759c32d61..6644e8f5f199 100644 --- a/net/8021q/vlan_dev.c +++ b/net/8021q/vlan_dev.c | |||
@@ -122,6 +122,11 @@ int vlan_skb_recv(struct sk_buff *skb, struct net_device *dev, | |||
122 | unsigned short vlan_TCI; | 122 | unsigned short vlan_TCI; |
123 | __be16 proto; | 123 | __be16 proto; |
124 | 124 | ||
125 | if (dev->nd_net != &init_net) { | ||
126 | kfree_skb(skb); | ||
127 | return -1; | ||
128 | } | ||
129 | |||
125 | if ((skb = skb_share_check(skb, GFP_ATOMIC)) == NULL) | 130 | if ((skb = skb_share_check(skb, GFP_ATOMIC)) == NULL) |
126 | return -1; | 131 | return -1; |
127 | 132 | ||
diff --git a/net/appletalk/aarp.c b/net/appletalk/aarp.c index 80b54148460f..9267f4818795 100644 --- a/net/appletalk/aarp.c +++ b/net/appletalk/aarp.c | |||
@@ -713,6 +713,9 @@ static int aarp_rcv(struct sk_buff *skb, struct net_device *dev, | |||
713 | struct atalk_addr sa, *ma, da; | 713 | struct atalk_addr sa, *ma, da; |
714 | struct atalk_iface *ifa; | 714 | struct atalk_iface *ifa; |
715 | 715 | ||
716 | if (dev->nd_net != &init_net) | ||
717 | goto out0; | ||
718 | |||
716 | /* We only do Ethernet SNAP AARP. */ | 719 | /* We only do Ethernet SNAP AARP. */ |
717 | if (dev->type != ARPHRD_ETHER) | 720 | if (dev->type != ARPHRD_ETHER) |
718 | goto out0; | 721 | goto out0; |
diff --git a/net/appletalk/ddp.c b/net/appletalk/ddp.c index fd1d52f09707..c1f1367cad48 100644 --- a/net/appletalk/ddp.c +++ b/net/appletalk/ddp.c | |||
@@ -1403,6 +1403,9 @@ static int atalk_rcv(struct sk_buff *skb, struct net_device *dev, | |||
1403 | int origlen; | 1403 | int origlen; |
1404 | __u16 len_hops; | 1404 | __u16 len_hops; |
1405 | 1405 | ||
1406 | if (dev->nd_net != &init_net) | ||
1407 | goto freeit; | ||
1408 | |||
1406 | /* Don't mangle buffer if shared */ | 1409 | /* Don't mangle buffer if shared */ |
1407 | if (!(skb = skb_share_check(skb, GFP_ATOMIC))) | 1410 | if (!(skb = skb_share_check(skb, GFP_ATOMIC))) |
1408 | goto out; | 1411 | goto out; |
@@ -1488,6 +1491,9 @@ freeit: | |||
1488 | static int ltalk_rcv(struct sk_buff *skb, struct net_device *dev, | 1491 | static int ltalk_rcv(struct sk_buff *skb, struct net_device *dev, |
1489 | struct packet_type *pt, struct net_device *orig_dev) | 1492 | struct packet_type *pt, struct net_device *orig_dev) |
1490 | { | 1493 | { |
1494 | if (dev->nd_net != &init_net) | ||
1495 | goto freeit; | ||
1496 | |||
1491 | /* Expand any short form frames */ | 1497 | /* Expand any short form frames */ |
1492 | if (skb_mac_header(skb)[2] == 1) { | 1498 | if (skb_mac_header(skb)[2] == 1) { |
1493 | struct ddpehdr *ddp; | 1499 | struct ddpehdr *ddp; |
diff --git a/net/ax25/ax25_in.c b/net/ax25/ax25_in.c index 0ddaff0df217..3b7d1720c2ee 100644 --- a/net/ax25/ax25_in.c +++ b/net/ax25/ax25_in.c | |||
@@ -451,6 +451,11 @@ int ax25_kiss_rcv(struct sk_buff *skb, struct net_device *dev, | |||
451 | skb->sk = NULL; /* Initially we don't know who it's for */ | 451 | skb->sk = NULL; /* Initially we don't know who it's for */ |
452 | skb->destructor = NULL; /* Who initializes this, dammit?! */ | 452 | skb->destructor = NULL; /* Who initializes this, dammit?! */ |
453 | 453 | ||
454 | if (dev->nd_net != &init_net) { | ||
455 | kfree_skb(skb); | ||
456 | return 0; | ||
457 | } | ||
458 | |||
454 | if ((*skb->data & 0x0F) != 0) { | 459 | if ((*skb->data & 0x0F) != 0) { |
455 | kfree_skb(skb); /* Not a KISS data frame */ | 460 | kfree_skb(skb); /* Not a KISS data frame */ |
456 | return 0; | 461 | return 0; |
diff --git a/net/bridge/br_stp_bpdu.c b/net/bridge/br_stp_bpdu.c index 14f0c888eecc..0edbd2a1c3f3 100644 --- a/net/bridge/br_stp_bpdu.c +++ b/net/bridge/br_stp_bpdu.c | |||
@@ -17,6 +17,7 @@ | |||
17 | #include <linux/netfilter_bridge.h> | 17 | #include <linux/netfilter_bridge.h> |
18 | #include <linux/etherdevice.h> | 18 | #include <linux/etherdevice.h> |
19 | #include <linux/llc.h> | 19 | #include <linux/llc.h> |
20 | #include <net/net_namespace.h> | ||
20 | #include <net/llc.h> | 21 | #include <net/llc.h> |
21 | #include <net/llc_pdu.h> | 22 | #include <net/llc_pdu.h> |
22 | #include <asm/unaligned.h> | 23 | #include <asm/unaligned.h> |
@@ -141,6 +142,9 @@ int br_stp_rcv(struct sk_buff *skb, struct net_device *dev, | |||
141 | struct net_bridge *br; | 142 | struct net_bridge *br; |
142 | const unsigned char *buf; | 143 | const unsigned char *buf; |
143 | 144 | ||
145 | if (dev->nd_net != &init_net) | ||
146 | goto err; | ||
147 | |||
144 | if (!p) | 148 | if (!p) |
145 | goto err; | 149 | goto err; |
146 | 150 | ||
diff --git a/net/decnet/dn_route.c b/net/decnet/dn_route.c index 4cfea9563d2a..580e786d0c38 100644 --- a/net/decnet/dn_route.c +++ b/net/decnet/dn_route.c | |||
@@ -584,6 +584,9 @@ int dn_route_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_type | |||
584 | struct dn_dev *dn = (struct dn_dev *)dev->dn_ptr; | 584 | struct dn_dev *dn = (struct dn_dev *)dev->dn_ptr; |
585 | unsigned char padlen = 0; | 585 | unsigned char padlen = 0; |
586 | 586 | ||
587 | if (dev->nd_net != &init_net) | ||
588 | goto dump_it; | ||
589 | |||
587 | if (dn == NULL) | 590 | if (dn == NULL) |
588 | goto dump_it; | 591 | goto dump_it; |
589 | 592 | ||
diff --git a/net/econet/af_econet.c b/net/econet/af_econet.c index a2429dbcb86e..7de3006af206 100644 --- a/net/econet/af_econet.c +++ b/net/econet/af_econet.c | |||
@@ -1065,6 +1065,9 @@ static int econet_rcv(struct sk_buff *skb, struct net_device *dev, struct packet | |||
1065 | struct sock *sk; | 1065 | struct sock *sk; |
1066 | struct ec_device *edev = dev->ec_ptr; | 1066 | struct ec_device *edev = dev->ec_ptr; |
1067 | 1067 | ||
1068 | if (dev->nd_net != &init_net) | ||
1069 | goto drop; | ||
1070 | |||
1068 | if (skb->pkt_type == PACKET_OTHERHOST) | 1071 | if (skb->pkt_type == PACKET_OTHERHOST) |
1069 | goto drop; | 1072 | goto drop; |
1070 | 1073 | ||
diff --git a/net/ipv4/arp.c b/net/ipv4/arp.c index 78dd3443016c..bde129708e22 100644 --- a/net/ipv4/arp.c +++ b/net/ipv4/arp.c | |||
@@ -932,6 +932,9 @@ static int arp_rcv(struct sk_buff *skb, struct net_device *dev, | |||
932 | { | 932 | { |
933 | struct arphdr *arp; | 933 | struct arphdr *arp; |
934 | 934 | ||
935 | if (dev->nd_net != &init_net) | ||
936 | goto freeskb; | ||
937 | |||
935 | /* ARP header, plus 2 device addresses, plus 2 IP addresses. */ | 938 | /* ARP header, plus 2 device addresses, plus 2 IP addresses. */ |
936 | if (!pskb_may_pull(skb, (sizeof(struct arphdr) + | 939 | if (!pskb_may_pull(skb, (sizeof(struct arphdr) + |
937 | (2 * dev->addr_len) + | 940 | (2 * dev->addr_len) + |
diff --git a/net/ipv4/ip_input.c b/net/ipv4/ip_input.c index 97069399d864..41d8964591e7 100644 --- a/net/ipv4/ip_input.c +++ b/net/ipv4/ip_input.c | |||
@@ -382,6 +382,9 @@ int ip_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_type *pt, | |||
382 | struct iphdr *iph; | 382 | struct iphdr *iph; |
383 | u32 len; | 383 | u32 len; |
384 | 384 | ||
385 | if (dev->nd_net != &init_net) | ||
386 | goto drop; | ||
387 | |||
385 | /* When the interface is in promisc. mode, drop all the crap | 388 | /* When the interface is in promisc. mode, drop all the crap |
386 | * that it receives, do not try to analyse it. | 389 | * that it receives, do not try to analyse it. |
387 | */ | 390 | */ |
diff --git a/net/ipv4/ipconfig.c b/net/ipv4/ipconfig.c index 5ae4849878a3..08ff623371f0 100644 --- a/net/ipv4/ipconfig.c +++ b/net/ipv4/ipconfig.c | |||
@@ -426,6 +426,9 @@ ic_rarp_recv(struct sk_buff *skb, struct net_device *dev, struct packet_type *pt | |||
426 | unsigned char *sha, *tha; /* s for "source", t for "target" */ | 426 | unsigned char *sha, *tha; /* s for "source", t for "target" */ |
427 | struct ic_device *d; | 427 | struct ic_device *d; |
428 | 428 | ||
429 | if (dev->nd_net != &init_net) | ||
430 | goto drop; | ||
431 | |||
429 | if ((skb = skb_share_check(skb, GFP_ATOMIC)) == NULL) | 432 | if ((skb = skb_share_check(skb, GFP_ATOMIC)) == NULL) |
430 | return NET_RX_DROP; | 433 | return NET_RX_DROP; |
431 | 434 | ||
@@ -835,6 +838,9 @@ static int __init ic_bootp_recv(struct sk_buff *skb, struct net_device *dev, str | |||
835 | struct ic_device *d; | 838 | struct ic_device *d; |
836 | int len, ext_len; | 839 | int len, ext_len; |
837 | 840 | ||
841 | if (dev->nd_net != &init_net) | ||
842 | goto drop; | ||
843 | |||
838 | /* Perform verifications before taking the lock. */ | 844 | /* Perform verifications before taking the lock. */ |
839 | if (skb->pkt_type == PACKET_OTHERHOST) | 845 | if (skb->pkt_type == PACKET_OTHERHOST) |
840 | goto drop; | 846 | goto drop; |
diff --git a/net/ipv6/ip6_input.c b/net/ipv6/ip6_input.c index 30a5cb1b203e..7d18cac3f110 100644 --- a/net/ipv6/ip6_input.c +++ b/net/ipv6/ip6_input.c | |||
@@ -61,6 +61,11 @@ int ipv6_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_type *pt | |||
61 | u32 pkt_len; | 61 | u32 pkt_len; |
62 | struct inet6_dev *idev; | 62 | struct inet6_dev *idev; |
63 | 63 | ||
64 | if (dev->nd_net != &init_net) { | ||
65 | kfree_skb(skb); | ||
66 | return 0; | ||
67 | } | ||
68 | |||
64 | if (skb->pkt_type == PACKET_OTHERHOST) { | 69 | if (skb->pkt_type == PACKET_OTHERHOST) { |
65 | kfree_skb(skb); | 70 | kfree_skb(skb); |
66 | return 0; | 71 | return 0; |
diff --git a/net/ipx/af_ipx.c b/net/ipx/af_ipx.c index ee28babad227..f7b4d383c609 100644 --- a/net/ipx/af_ipx.c +++ b/net/ipx/af_ipx.c | |||
@@ -1647,6 +1647,9 @@ static int ipx_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_ty | |||
1647 | u16 ipx_pktsize; | 1647 | u16 ipx_pktsize; |
1648 | int rc = 0; | 1648 | int rc = 0; |
1649 | 1649 | ||
1650 | if (dev->nd_net != &init_net) | ||
1651 | goto drop; | ||
1652 | |||
1650 | /* Not ours */ | 1653 | /* Not ours */ |
1651 | if (skb->pkt_type == PACKET_OTHERHOST) | 1654 | if (skb->pkt_type == PACKET_OTHERHOST) |
1652 | goto drop; | 1655 | goto drop; |
diff --git a/net/irda/irlap_frame.c b/net/irda/irlap_frame.c index 25a3444a9234..77ac27e81161 100644 --- a/net/irda/irlap_frame.c +++ b/net/irda/irlap_frame.c | |||
@@ -1326,6 +1326,9 @@ int irlap_driver_rcv(struct sk_buff *skb, struct net_device *dev, | |||
1326 | int command; | 1326 | int command; |
1327 | __u8 control; | 1327 | __u8 control; |
1328 | 1328 | ||
1329 | if (dev->nd_net != &init_net) | ||
1330 | goto out; | ||
1331 | |||
1329 | /* FIXME: should we get our own field? */ | 1332 | /* FIXME: should we get our own field? */ |
1330 | self = (struct irlap_cb *) dev->atalk_ptr; | 1333 | self = (struct irlap_cb *) dev->atalk_ptr; |
1331 | 1334 | ||
diff --git a/net/llc/llc_input.c b/net/llc/llc_input.c index 099ed8fec145..c40c9b2a345a 100644 --- a/net/llc/llc_input.c +++ b/net/llc/llc_input.c | |||
@@ -12,6 +12,7 @@ | |||
12 | * See the GNU General Public License for more details. | 12 | * See the GNU General Public License for more details. |
13 | */ | 13 | */ |
14 | #include <linux/netdevice.h> | 14 | #include <linux/netdevice.h> |
15 | #include <net/net_namespace.h> | ||
15 | #include <net/llc.h> | 16 | #include <net/llc.h> |
16 | #include <net/llc_pdu.h> | 17 | #include <net/llc_pdu.h> |
17 | #include <net/llc_sap.h> | 18 | #include <net/llc_sap.h> |
@@ -145,6 +146,9 @@ int llc_rcv(struct sk_buff *skb, struct net_device *dev, | |||
145 | int (*rcv)(struct sk_buff *, struct net_device *, | 146 | int (*rcv)(struct sk_buff *, struct net_device *, |
146 | struct packet_type *, struct net_device *); | 147 | struct packet_type *, struct net_device *); |
147 | 148 | ||
149 | if (dev->nd_net != &init_net) | ||
150 | goto drop; | ||
151 | |||
148 | /* | 152 | /* |
149 | * When the interface is in promisc. mode, drop all the crap that it | 153 | * When the interface is in promisc. mode, drop all the crap that it |
150 | * receives, do not try to analyse it. | 154 | * receives, do not try to analyse it. |
diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c index 766b5faaed21..cae1ee4f2ad6 100644 --- a/net/packet/af_packet.c +++ b/net/packet/af_packet.c | |||
@@ -252,6 +252,9 @@ static int packet_rcv_spkt(struct sk_buff *skb, struct net_device *dev, struct | |||
252 | struct sock *sk; | 252 | struct sock *sk; |
253 | struct sockaddr_pkt *spkt; | 253 | struct sockaddr_pkt *spkt; |
254 | 254 | ||
255 | if (dev->nd_net != &init_net) | ||
256 | goto out; | ||
257 | |||
255 | /* | 258 | /* |
256 | * When we registered the protocol we saved the socket in the data | 259 | * When we registered the protocol we saved the socket in the data |
257 | * field for just this event. | 260 | * field for just this event. |
@@ -452,6 +455,9 @@ static int packet_rcv(struct sk_buff *skb, struct net_device *dev, struct packet | |||
452 | int skb_len = skb->len; | 455 | int skb_len = skb->len; |
453 | unsigned int snaplen, res; | 456 | unsigned int snaplen, res; |
454 | 457 | ||
458 | if (dev->nd_net != &init_net) | ||
459 | goto drop; | ||
460 | |||
455 | if (skb->pkt_type == PACKET_LOOPBACK) | 461 | if (skb->pkt_type == PACKET_LOOPBACK) |
456 | goto drop; | 462 | goto drop; |
457 | 463 | ||
@@ -568,6 +574,9 @@ static int tpacket_rcv(struct sk_buff *skb, struct net_device *dev, struct packe | |||
568 | struct sk_buff *copy_skb = NULL; | 574 | struct sk_buff *copy_skb = NULL; |
569 | struct timeval tv; | 575 | struct timeval tv; |
570 | 576 | ||
577 | if (dev->nd_net != &init_net) | ||
578 | goto drop; | ||
579 | |||
571 | if (skb->pkt_type == PACKET_LOOPBACK) | 580 | if (skb->pkt_type == PACKET_LOOPBACK) |
572 | goto drop; | 581 | goto drop; |
573 | 582 | ||
diff --git a/net/tipc/eth_media.c b/net/tipc/eth_media.c index 711ca4b1f051..d2ed23704189 100644 --- a/net/tipc/eth_media.c +++ b/net/tipc/eth_media.c | |||
@@ -38,6 +38,7 @@ | |||
38 | #include <net/tipc/tipc_bearer.h> | 38 | #include <net/tipc/tipc_bearer.h> |
39 | #include <net/tipc/tipc_msg.h> | 39 | #include <net/tipc/tipc_msg.h> |
40 | #include <linux/netdevice.h> | 40 | #include <linux/netdevice.h> |
41 | #include <net/net_namespace.h> | ||
41 | 42 | ||
42 | #define MAX_ETH_BEARERS 2 | 43 | #define MAX_ETH_BEARERS 2 |
43 | #define ETH_LINK_PRIORITY TIPC_DEF_LINK_PRI | 44 | #define ETH_LINK_PRIORITY TIPC_DEF_LINK_PRI |
@@ -100,6 +101,11 @@ static int recv_msg(struct sk_buff *buf, struct net_device *dev, | |||
100 | struct eth_bearer *eb_ptr = (struct eth_bearer *)pt->af_packet_priv; | 101 | struct eth_bearer *eb_ptr = (struct eth_bearer *)pt->af_packet_priv; |
101 | u32 size; | 102 | u32 size; |
102 | 103 | ||
104 | if (dev->nd_net != &init_net) { | ||
105 | kfree_skb(buf); | ||
106 | return 0; | ||
107 | } | ||
108 | |||
103 | if (likely(eb_ptr->bearer)) { | 109 | if (likely(eb_ptr->bearer)) { |
104 | if (likely(buf->pkt_type <= PACKET_BROADCAST)) { | 110 | if (likely(buf->pkt_type <= PACKET_BROADCAST)) { |
105 | size = msg_size((struct tipc_msg *)buf->data); | 111 | size = msg_size((struct tipc_msg *)buf->data); |
diff --git a/net/x25/x25_dev.c b/net/x25/x25_dev.c index 848a6b6f90a6..f0679d283110 100644 --- a/net/x25/x25_dev.c +++ b/net/x25/x25_dev.c | |||
@@ -95,6 +95,9 @@ int x25_lapb_receive_frame(struct sk_buff *skb, struct net_device *dev, | |||
95 | struct sk_buff *nskb; | 95 | struct sk_buff *nskb; |
96 | struct x25_neigh *nb; | 96 | struct x25_neigh *nb; |
97 | 97 | ||
98 | if (dev->nd_net != &init_net) | ||
99 | goto drop; | ||
100 | |||
98 | nskb = skb_copy(skb, GFP_ATOMIC); | 101 | nskb = skb_copy(skb, GFP_ATOMIC); |
99 | if (!nskb) | 102 | if (!nskb) |
100 | goto drop; | 103 | goto drop; |