[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <1450285057.8474.80.camel@edumazet-glaptop2.roam.corp.google.com>
Date: Wed, 16 Dec 2015 08:57:37 -0800
From: Eric Dumazet <eric.dumazet@...il.com>
To: David Miller <davem@...emloft.net>
Cc: netdev <netdev@...r.kernel.org>, Curt Wohlgemuth <curtw@...gle.com>
Subject: [PATCH net-next] tun: honor IFF_UP in tun_get_user()
From: Eric Dumazet <edumazet@...gle.com>
If a tun interface is turned down, we should not allow packet injection
into the kernel.
Kernel does not send packets to the tun already.
TUNATTACHFILTER can not be used as only tun_net_xmit() is taking care
of it.
Reported-by: Curt Wohlgemuth <curtw@...gle.com>
Signed-off-by: Eric Dumazet <edumazet@...gle.com>
---
drivers/net/tun.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/net/tun.c b/drivers/net/tun.c
index f0db770e8b2f..88bb8cc3555b 100644
--- a/drivers/net/tun.c
+++ b/drivers/net/tun.c
@@ -1095,6 +1095,9 @@ static ssize_t tun_get_user(struct tun_struct *tun, struct tun_file *tfile,
u32 rxhash;
ssize_t n;
+ if (!(tun->dev->flags & IFF_UP))
+ return -EIO;
+
if (!(tun->flags & IFF_NO_PI)) {
if (len < sizeof(pi))
return -EINVAL;
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists