提交 74462f0d 编写于 作者: N Nicolas Dichtel 提交者: David S. Miller

ip6_tunnel: use the right netns in ioctl handler

Because the netdevice may be in another netns than the i/o netns, we should
use the i/o netns instead of dev_net(dev).
Signed-off-by: NNicolas Dichtel <nicolas.dichtel@6wind.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 9aad77c3
...@@ -1340,8 +1340,8 @@ ip6_tnl_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) ...@@ -1340,8 +1340,8 @@ ip6_tnl_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
int err = 0; int err = 0;
struct ip6_tnl_parm p; struct ip6_tnl_parm p;
struct __ip6_tnl_parm p1; struct __ip6_tnl_parm p1;
struct ip6_tnl *t = NULL; struct ip6_tnl *t = netdev_priv(dev);
struct net *net = dev_net(dev); struct net *net = t->net;
struct ip6_tnl_net *ip6n = net_generic(net, ip6_tnl_net_id); struct ip6_tnl_net *ip6n = net_generic(net, ip6_tnl_net_id);
switch (cmd) { switch (cmd) {
...@@ -1353,11 +1353,11 @@ ip6_tnl_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) ...@@ -1353,11 +1353,11 @@ ip6_tnl_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
} }
ip6_tnl_parm_from_user(&p1, &p); ip6_tnl_parm_from_user(&p1, &p);
t = ip6_tnl_locate(net, &p1, 0); t = ip6_tnl_locate(net, &p1, 0);
if (t == NULL)
t = netdev_priv(dev);
} else { } else {
memset(&p, 0, sizeof(p)); memset(&p, 0, sizeof(p));
} }
if (t == NULL)
t = netdev_priv(dev);
ip6_tnl_parm_to_user(&p, &t->parms); ip6_tnl_parm_to_user(&p, &t->parms);
if (copy_to_user(ifr->ifr_ifru.ifru_data, &p, sizeof (p))) { if (copy_to_user(ifr->ifr_ifru.ifru_data, &p, sizeof (p))) {
err = -EFAULT; err = -EFAULT;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册