Skip to content

Commit

Permalink
tun: Return -EINVAL if neither IFF_TUN nor IFF_TAP is set.
Browse files Browse the repository at this point in the history
After commit 2b980db
("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>
  • Loading branch information
Kusanagi Kouichi authored and David S. Miller committed Sep 22, 2009
1 parent 9cc4085 commit 36989b9
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions drivers/net/tun.c
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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;
Expand Down

0 comments on commit 36989b9

Please sign in to comment.