summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKusanagi Kouichi <slash@ma.neweb.ne.jp>2009-09-16 21:36:13 +0000
committerGreg Kroah-Hartman <gregkh@suse.de>2009-10-12 12:40:26 -0700
commit0568d3bf197d1e7db746d4a73cbd59b1850d23e6 (patch)
tree31517738475e33d52b4127b21a40237a1b1960c6
parent7d07d6b33de75277e8a387a37ea9fc78c131d8f4 (diff)
downloadlwn-0568d3bf197d1e7db746d4a73cbd59b1850d23e6.tar.gz
lwn-0568d3bf197d1e7db746d4a73cbd59b1850d23e6.zip
tun: Return -EINVAL if neither IFF_TUN nor IFF_TAP is set.
[ Upstream commit 36989b90879c785f95b877bdcf65a2527dadd893 ] After commit 2b980dbd77d229eb60588802162c9659726b11f4 ("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: Kusanagi Kouichi <slash@ma.neweb.ne.jp> Reviewed-by: Paul Moore <paul.moore@hp.com> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-rw-r--r--drivers/net/tun.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/drivers/net/tun.c b/drivers/net/tun.c
index 42b6c6319bc2..156f59b25191 100644
--- a/drivers/net/tun.c
+++ b/drivers/net/tun.c
@@ -943,8 +943,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;
@@ -958,7 +956,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;