diff options
author | Eric Dumazet <edumazet@google.com> | 2015-12-16 16:57:37 (GMT) |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2015-12-17 20:25:57 (GMT) |
commit | 1bd4978a88ac2589f3105f599b1d404a312fb7f6 (patch) | |
tree | 04d86f96dfb815ffb3d0e2a7cc1e01bcd23b48af /drivers/net/tun.c | |
parent | 715f504b118998c41a2079a17e16bf5a8a114885 (diff) | |
download | linux-1bd4978a88ac2589f3105f599b1d404a312fb7f6.tar.xz |
tun: honor IFF_UP in tun_get_user()
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@google.com>
Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/tun.c')
-rw-r--r-- | drivers/net/tun.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/net/tun.c b/drivers/net/tun.c index f0db770..88bb8cc 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; |