提交 387ff911 编写于 作者: G Gao feng 提交者: David S. Miller

netns: bond: allow unprivileged users to control bond device

reduce the permission check of bond device's ioctl.
allow the userns root to control the bond device.
Signed-off-by: NGao feng <gaofeng@cn.fujitsu.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 e4d343ea
...@@ -3612,6 +3612,7 @@ static int bond_do_ioctl(struct net_device *bond_dev, struct ifreq *ifr, int cmd ...@@ -3612,6 +3612,7 @@ static int bond_do_ioctl(struct net_device *bond_dev, struct ifreq *ifr, int cmd
struct ifslave k_sinfo; struct ifslave k_sinfo;
struct ifslave __user *u_sinfo = NULL; struct ifslave __user *u_sinfo = NULL;
struct mii_ioctl_data *mii = NULL; struct mii_ioctl_data *mii = NULL;
struct net *net;
int res = 0; int res = 0;
pr_debug("bond_ioctl: master=%s, cmd=%d\n", bond_dev->name, cmd); pr_debug("bond_ioctl: master=%s, cmd=%d\n", bond_dev->name, cmd);
...@@ -3678,10 +3679,12 @@ static int bond_do_ioctl(struct net_device *bond_dev, struct ifreq *ifr, int cmd ...@@ -3678,10 +3679,12 @@ static int bond_do_ioctl(struct net_device *bond_dev, struct ifreq *ifr, int cmd
break; break;
} }
if (!capable(CAP_NET_ADMIN)) net = dev_net(bond_dev);
if (!ns_capable(net->user_ns, CAP_NET_ADMIN))
return -EPERM; return -EPERM;
slave_dev = dev_get_by_name(dev_net(bond_dev), ifr->ifr_slave); slave_dev = dev_get_by_name(net, ifr->ifr_slave);
pr_debug("slave_dev=%p:\n", slave_dev); pr_debug("slave_dev=%p:\n", slave_dev);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册