From: Eric Dumazet Date: Wed, 16 Dec 2015 16:57:37 +0000 (-0800) Subject: tun: honor IFF_UP in tun_get_user() X-Git-Tag: v4.9.8~2476^2~464 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=1bd4978a88ac2589f3105f599b1d404a312fb7f6;p=platform%2Fkernel%2Flinux-rpi3.git 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 Signed-off-by: Eric Dumazet Signed-off-by: David S. Miller --- 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;