提交 36989b90 编写于 作者: K Kusanagi Kouichi 提交者: David S. Miller

tun: Return -EINVAL if neither IFF_TUN nor IFF_TAP is set.

After commit 2b980dbd
("lsm: Add hooks to the TUN driver") tun_set_iff doesn't
return -EINVAL though neither IFF_TUN nor IFF_TAP is set.
Signed-off-by: NKusanagi Kouichi <slash@ma.neweb.ne.jp>
Reviewed-by: NPaul Moore <paul.moore@hp.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 9cc40855
......@@ -946,8 +946,6 @@ static int tun_set_iff(struct net *net, struct file *file, struct ifreq *ifr)
char *name;
unsigned long flags = 0;
err = -EINVAL;
if (!capable(CAP_NET_ADMIN))
return -EPERM;
err = security_tun_dev_create();
......@@ -964,7 +962,7 @@ static int tun_set_iff(struct net *net, struct file *file, struct ifreq *ifr)
flags |= TUN_TAP_DEV;
name = "tap%d";
} else
goto failed;
return -EINVAL;
if (*ifr->ifr_name)
name = ifr->ifr_name;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册