diff options
author | Kusanagi Kouichi <slash@ma.neweb.ne.jp> | 2009-09-16 17:36:13 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-09-22 17:00:16 -0400 |
commit | 36989b90879c785f95b877bdcf65a2527dadd893 (patch) | |
tree | d9ee451eca172d28112e092bac53dca927f98044 /drivers/net/tun.c | |
parent | 9cc4085585a011179caf86a6408225626f6c2263 (diff) |
tun: Return -EINVAL if neither IFF_TUN nor IFF_TAP is set.
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>
Diffstat (limited to 'drivers/net/tun.c')
-rw-r--r-- | drivers/net/tun.c | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/drivers/net/tun.c b/drivers/net/tun.c index 3f5d28851aa2..e091756166a3 100644 --- a/drivers/net/tun.c +++ b/drivers/net/tun.c | |||
@@ -946,8 +946,6 @@ static int tun_set_iff(struct net *net, struct file *file, struct ifreq *ifr) | |||
946 | char *name; | 946 | char *name; |
947 | unsigned long flags = 0; | 947 | unsigned long flags = 0; |
948 | 948 | ||
949 | err = -EINVAL; | ||
950 | |||
951 | if (!capable(CAP_NET_ADMIN)) | 949 | if (!capable(CAP_NET_ADMIN)) |
952 | return -EPERM; | 950 | return -EPERM; |
953 | err = security_tun_dev_create(); | 951 | err = security_tun_dev_create(); |
@@ -964,7 +962,7 @@ static int tun_set_iff(struct net *net, struct file *file, struct ifreq *ifr) | |||
964 | flags |= TUN_TAP_DEV; | 962 | flags |= TUN_TAP_DEV; |
965 | name = "tap%d"; | 963 | name = "tap%d"; |
966 | } else | 964 | } else |
967 | goto failed; | 965 | return -EINVAL; |
968 | 966 | ||
969 | if (*ifr->ifr_name) | 967 | if (*ifr->ifr_name) |
970 | name = ifr->ifr_name; | 968 | name = ifr->ifr_name; |