[patch 29/37] tun: Return -EINVAL if neither IFF_TUN nor IFF_TAP is set.

From: Greg KH
Date: Fri Oct 09 2009 - 19:43:02 EST


2.6.31-stable review patch. If anyone has any objections, please let us know.

------------------
From: Kusanagi Kouichi <slash@xxxxxxxxxxxxxx>

[ 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@xxxxxxxxxxxxxx>
Reviewed-by: Paul Moore <paul.moore@xxxxxx>
Signed-off-by: David S. Miller <davem@xxxxxxxxxxxxx>
Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxx>
---
drivers/net/tun.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)

--- a/drivers/net/tun.c
+++ b/drivers/net/tun.c
@@ -943,8 +943,6 @@ static int tun_set_iff(struct net *net,
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,
flags |= TUN_TAP_DEV;
name = "tap%d";
} else
- goto failed;
+ return -EINVAL;

if (*ifr->ifr_name)
name = ifr->ifr_name;


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/