]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
net/tun: fix ioctl() based info leaks
authorMathias Krause <minipli@googlemail.com>
Sun, 29 Jul 2012 19:45:14 +0000 (19:45 +0000)
committerDavid S. Miller <davem@davemloft.net>
Mon, 30 Jul 2012 06:18:31 +0000 (23:18 -0700)
The tun module leaks up to 36 bytes of memory by not fully initializing
a structure located on the stack that gets copied to user memory by the
TUNGETIFF and SIOCGIFHWADDR ioctl()s.

Signed-off-by: Mathias Krause <minipli@googlemail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
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?".