net/tun: fix ioctl() based info leaks
[deliverable/linux.git] / drivers / net / tun.c
index c62163e272cd8548ab0586e6655a4d04d98bcb08..f55c46222613f01f44b14f3455c38d832b2fc6fe 100644 (file)
@@ -1379,9 +1379,11 @@ static long __tun_chr_ioctl(struct file *file, unsigned int cmd,
        int vnet_hdr_sz;
        int ret;
 
-       if (cmd == TUNSETIFF || _IOC_TYPE(cmd) == 0x89)
+       if (cmd == TUNSETIFF || _IOC_TYPE(cmd) == 0x89) {
                if (copy_from_user(&ifr, argp, ifreq_len))
                        return -EFAULT;
+       } else
+               memset(&ifr, 0, sizeof(ifr));
 
        if (cmd == TUNGETFEATURES) {
                /* Currently this just means: "what IFF flags are valid?".
This page took 0.024839 seconds and 5 git commands to generate.