aboutsummaryrefslogtreecommitdiffstats
path: root/net/core/rtnetlink.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/core/rtnetlink.c')
-rw-r--r--net/core/rtnetlink.c13
1 files changed, 4 insertions, 9 deletions
diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
index a40c10b96f47..575a6ee89944 100644
--- a/net/core/rtnetlink.c
+++ b/net/core/rtnetlink.c
@@ -1316,6 +1316,10 @@ static int do_setlink(struct net_device *dev, struct ifinfomsg *ifm,
1316 err = PTR_ERR(net); 1316 err = PTR_ERR(net);
1317 goto errout; 1317 goto errout;
1318 } 1318 }
1319 if (!ns_capable(net->user_ns, CAP_NET_ADMIN)) {
1320 err = -EPERM;
1321 goto errout;
1322 }
1319 err = dev_change_net_namespace(dev, net, ifname); 1323 err = dev_change_net_namespace(dev, net, ifname);
1320 put_net(net); 1324 put_net(net);
1321 if (err) 1325 if (err)
@@ -1547,9 +1551,6 @@ static int rtnl_setlink(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg)
1547 struct nlattr *tb[IFLA_MAX+1]; 1551 struct nlattr *tb[IFLA_MAX+1];
1548 char ifname[IFNAMSIZ]; 1552 char ifname[IFNAMSIZ];
1549 1553
1550 if (!capable(CAP_NET_ADMIN))
1551 return -EPERM;
1552
1553 err = nlmsg_parse(nlh, sizeof(*ifm), tb, IFLA_MAX, ifla_policy); 1554 err = nlmsg_parse(nlh, sizeof(*ifm), tb, IFLA_MAX, ifla_policy);
1554 if (err < 0) 1555 if (err < 0)
1555 goto errout; 1556 goto errout;
@@ -1593,9 +1594,6 @@ static int rtnl_dellink(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg)
1593 int err; 1594 int err;
1594 LIST_HEAD(list_kill); 1595 LIST_HEAD(list_kill);
1595 1596
1596 if (!capable(CAP_NET_ADMIN))
1597 return -EPERM;
1598
1599 err = nlmsg_parse(nlh, sizeof(*ifm), tb, IFLA_MAX, ifla_policy); 1597 err = nlmsg_parse(nlh, sizeof(*ifm), tb, IFLA_MAX, ifla_policy);
1600 if (err < 0) 1598 if (err < 0)
1601 return err; 1599 return err;
@@ -1726,9 +1724,6 @@ static int rtnl_newlink(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg)
1726 struct nlattr *linkinfo[IFLA_INFO_MAX+1]; 1724 struct nlattr *linkinfo[IFLA_INFO_MAX+1];
1727 int err; 1725 int err;
1728 1726
1729 if (!capable(CAP_NET_ADMIN))
1730 return -EPERM;
1731
1732#ifdef CONFIG_MODULES 1727#ifdef CONFIG_MODULES
1733replay: 1728replay:
1734#endif 1729#endif