mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-08-27 11:19:37 +00:00
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: 317f4810e4
("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>
This commit is contained in:
parent
505ce4154a
commit
06615bed60
1 changed files with 3 additions and 0 deletions
|
@ -2134,6 +2134,9 @@ static int rtnl_newlink(struct sk_buff *skb, struct nlmsghdr *nlh)
|
|||
err = -EINVAL;
|
||||
goto out;
|
||||
}
|
||||
err = -EPERM;
|
||||
if (!netlink_ns_capable(skb, link_net->user_ns, CAP_NET_ADMIN))
|
||||
goto out;
|
||||
}
|
||||
|
||||
dev = rtnl_create_link(link_net ? : dest_net, ifname,
|
||||
|
|
Loading…
Reference in a new issue