Commit 0568d3bf authored by Kusanagi Kouichi's avatar Kusanagi Kouichi Committed by Greg Kroah-Hartman

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

[ Upstream commit 36989b90 ]

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: default avatarKusanagi Kouichi <slash@ma.neweb.ne.jp>
Reviewed-by: default avatarPaul Moore <paul.moore@hp.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 7d07d6b3
...@@ -943,8 +943,6 @@ static int tun_set_iff(struct net *net, struct file *file, struct ifreq *ifr) ...@@ -943,8 +943,6 @@ static int tun_set_iff(struct net *net, struct file *file, struct ifreq *ifr)
char *name; char *name;
unsigned long flags = 0; unsigned long flags = 0;
err = -EINVAL;
if (!capable(CAP_NET_ADMIN)) if (!capable(CAP_NET_ADMIN))
return -EPERM; return -EPERM;
...@@ -958,7 +956,7 @@ static int tun_set_iff(struct net *net, struct file *file, struct ifreq *ifr) ...@@ -958,7 +956,7 @@ static int tun_set_iff(struct net *net, struct file *file, struct ifreq *ifr)
flags |= TUN_TAP_DEV; flags |= TUN_TAP_DEV;
name = "tap%d"; name = "tap%d";
} else } else
goto failed; return -EINVAL;
if (*ifr->ifr_name) if (*ifr->ifr_name)
name = ifr->ifr_name; name = ifr->ifr_name;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment