diff options
author | Eric W. Biederman <ebiederm@xmission.com> | 2015-02-26 17:20:07 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2015-02-28 15:14:44 -0500 |
commit | 06615bed60c1fb7c37adddb75bdc80da873b5edb (patch) | |
tree | 5aec831c22db9ff0326d701b03059b09ead59aaf | |
parent | 505ce4154ac86c250aa4a84a536dd9fc56479bb5 (diff) |
net: Verify permission to link_net in newlink
When applicable verify that the caller has permisson to the underlying
network namespace for a newly created network device.
Similary checks exist for the network namespace a network device will
be created in.
Fixes: 317f4810e45e ("rtnl: allow to create device with IFLA_LINK_NETNSID set")
Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
Acked-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | net/core/rtnetlink.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c index b237959c7497..2c49355d16c2 100644 --- a/net/core/rtnetlink.c +++ b/net/core/rtnetlink.c | |||
@@ -2134,6 +2134,9 @@ replay: | |||
2134 | err = -EINVAL; | 2134 | err = -EINVAL; |
2135 | goto out; | 2135 | goto out; |
2136 | } | 2136 | } |
2137 | err = -EPERM; | ||
2138 | if (!netlink_ns_capable(skb, link_net->user_ns, CAP_NET_ADMIN)) | ||
2139 | goto out; | ||
2137 | } | 2140 | } |
2138 | 2141 | ||
2139 | dev = rtnl_create_link(link_net ? : dest_net, ifname, | 2142 | dev = rtnl_create_link(link_net ? : dest_net, ifname, |