]> git.ipfire.org Git - thirdparty/kernel/stable.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)
committerPaul Gortmaker <paul.gortmaker@windriver.com>
Mon, 10 Feb 2014 21:10:57 +0000 (16:10 -0500)
commit a117dacde0288f3ec60b6e5bcedae8fa37ee0dfc upstream.

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>
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
drivers/net/tun.c

index 7b4a88b2f696099d26f17da987cfe35c9a05bbe8..c777d8ebdaa8f9a7ee4075ff89292a2390d267ab 100644 (file)
@@ -1177,9 +1177,11 @@ static long __tun_chr_ioctl(struct file *file, unsigned int cmd,
        int sndbuf;
        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?".