aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorEric W. Biederman <ebiederm@xmission.com>2015-02-26 17:19:00 -0500
committerDavid S. Miller <davem@davemloft.net>2015-02-28 15:14:44 -0500
commit505ce4154ac86c250aa4a84a536dd9fc56479bb5 (patch)
tree857c9f8d321d1413d001081def142ae648b0f409 /net
parent5688714977ebefa92e6dad8bd94bffaeaadc303d (diff)
net: Verify permission to dest_net in newlink
When applicable verify that the caller has permision to create a network device in another network namespace. This check is already present when moving a network device between network namespaces in setlink so all that is needed is to duplicate that check in newlink. This change almost backports cleanly, but there are context conflicts as the code that follows was added in v4.0-rc1 Fixes: b51642f6d77b net: Enable a userns root rtnl calls that are safe for unprivilged users 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>
Diffstat (limited to 'net')
-rw-r--r--net/core/rtnetlink.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
index 1385de0fa080..b237959c7497 100644
--- a/net/core/rtnetlink.c
+++ b/net/core/rtnetlink.c
@@ -2122,6 +2122,10 @@ replay:
2122 if (IS_ERR(dest_net)) 2122 if (IS_ERR(dest_net))
2123 return PTR_ERR(dest_net); 2123 return PTR_ERR(dest_net);
2124 2124
2125 err = -EPERM;
2126 if (!netlink_ns_capable(skb, dest_net->user_ns, CAP_NET_ADMIN))
2127 goto out;
2128
2125 if (tb[IFLA_LINK_NETNSID]) { 2129 if (tb[IFLA_LINK_NETNSID]) {
2126 int id = nla_get_s32(tb[IFLA_LINK_NETNSID]); 2130 int id = nla_get_s32(tb[IFLA_LINK_NETNSID]);
2127 2131