Skip to content

Commit 06615be

Browse files
ebiedermdavem330
authored andcommitted
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: 317f481 ("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>
1 parent 505ce41 commit 06615be

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

‎net/core/rtnetlink.c‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2134,6 +2134,9 @@ static int rtnl_newlink(struct sk_buff *skb, struct nlmsghdr *nlh)
21342134
err = -EINVAL;
21352135
goto out;
21362136
}
2137+
err = -EPERM;
2138+
if (!netlink_ns_capable(skb, link_net->user_ns, CAP_NET_ADMIN))
2139+
goto out;
21372140
}
21382141

21392142
dev = rtnl_create_link(link_net ? : dest_net, ifname,

0 commit comments

Comments
 (0)