diff options
Diffstat (limited to 'net/ipv4/devinet.c')
-rw-r--r-- | net/ipv4/devinet.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/net/ipv4/devinet.c b/net/ipv4/devinet.c index b42f74617bac..c0eb26a0d0bc 100644 --- a/net/ipv4/devinet.c +++ b/net/ipv4/devinet.c | |||
@@ -441,6 +441,7 @@ struct in_ifaddr *inet_ifa_byprefix(struct in_device *in_dev, __be32 prefix, | |||
441 | 441 | ||
442 | static int inet_rtm_deladdr(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg) | 442 | static int inet_rtm_deladdr(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg) |
443 | { | 443 | { |
444 | struct net *net = skb->sk->sk_net; | ||
444 | struct nlattr *tb[IFA_MAX+1]; | 445 | struct nlattr *tb[IFA_MAX+1]; |
445 | struct in_device *in_dev; | 446 | struct in_device *in_dev; |
446 | struct ifaddrmsg *ifm; | 447 | struct ifaddrmsg *ifm; |
@@ -449,6 +450,9 @@ static int inet_rtm_deladdr(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg | |||
449 | 450 | ||
450 | ASSERT_RTNL(); | 451 | ASSERT_RTNL(); |
451 | 452 | ||
453 | if (net != &init_net) | ||
454 | return -EINVAL; | ||
455 | |||
452 | err = nlmsg_parse(nlh, sizeof(*ifm), tb, IFA_MAX, ifa_ipv4_policy); | 456 | err = nlmsg_parse(nlh, sizeof(*ifm), tb, IFA_MAX, ifa_ipv4_policy); |
453 | if (err < 0) | 457 | if (err < 0) |
454 | goto errout; | 458 | goto errout; |
@@ -560,10 +564,14 @@ errout: | |||
560 | 564 | ||
561 | static int inet_rtm_newaddr(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg) | 565 | static int inet_rtm_newaddr(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg) |
562 | { | 566 | { |
567 | struct net *net = skb->sk->sk_net; | ||
563 | struct in_ifaddr *ifa; | 568 | struct in_ifaddr *ifa; |
564 | 569 | ||
565 | ASSERT_RTNL(); | 570 | ASSERT_RTNL(); |
566 | 571 | ||
572 | if (net != &init_net) | ||
573 | return -EINVAL; | ||
574 | |||
567 | ifa = rtm_to_ifaddr(nlh); | 575 | ifa = rtm_to_ifaddr(nlh); |
568 | if (IS_ERR(ifa)) | 576 | if (IS_ERR(ifa)) |
569 | return PTR_ERR(ifa); | 577 | return PTR_ERR(ifa); |
@@ -1174,12 +1182,16 @@ nla_put_failure: | |||
1174 | 1182 | ||
1175 | static int inet_dump_ifaddr(struct sk_buff *skb, struct netlink_callback *cb) | 1183 | static int inet_dump_ifaddr(struct sk_buff *skb, struct netlink_callback *cb) |
1176 | { | 1184 | { |
1185 | struct net *net = skb->sk->sk_net; | ||
1177 | int idx, ip_idx; | 1186 | int idx, ip_idx; |
1178 | struct net_device *dev; | 1187 | struct net_device *dev; |
1179 | struct in_device *in_dev; | 1188 | struct in_device *in_dev; |
1180 | struct in_ifaddr *ifa; | 1189 | struct in_ifaddr *ifa; |
1181 | int s_ip_idx, s_idx = cb->args[0]; | 1190 | int s_ip_idx, s_idx = cb->args[0]; |
1182 | 1191 | ||
1192 | if (net != &init_net) | ||
1193 | return 0; | ||
1194 | |||
1183 | s_ip_idx = ip_idx = cb->args[1]; | 1195 | s_ip_idx = ip_idx = cb->args[1]; |
1184 | idx = 0; | 1196 | idx = 0; |
1185 | for_each_netdev(&init_net, dev) { | 1197 | for_each_netdev(&init_net, dev) { |