diff options
author | Mathias Krause <minipli@googlemail.com> | 2012-07-29 19:45:14 +0000 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2012-08-09 08:31:51 -0700 |
commit | 143d9963df6580491f9a5c38c9d4883786f78123 (patch) | |
tree | ffb8f59e0ed3715d6a14b8664ebd937bc9b4e9dd /drivers | |
parent | 2ce42ec4ef551b08d2e5d26775d838ac640f82ad (diff) | |
download | lwn-143d9963df6580491f9a5c38c9d4883786f78123.tar.gz lwn-143d9963df6580491f9a5c38c9d4883786f78123.zip |
net/tun: fix ioctl() based info leaks
[ Upstream commits a117dacde0288f3ec60b6e5bcedae8fa37ee0dfc
and 8bbb181308bc348e02bfdbebdedd4e4ec9d452ce ]
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: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/tun.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/drivers/net/tun.c b/drivers/net/tun.c index a06ad55d949c..8f13420dd31a 100644 --- a/drivers/net/tun.c +++ b/drivers/net/tun.c @@ -1255,10 +1255,12 @@ 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 is needed because we never checked for invalid flags on |