diff options
author | Mathias Krause <minipli@googlemail.com> | 2012-07-29 15:45:14 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2012-07-30 02:18:31 -0400 |
commit | a117dacde0288f3ec60b6e5bcedae8fa37ee0dfc (patch) | |
tree | c32e1dc90154dbd1ab9e694fee3fa810755b6403 /drivers/net | |
parent | cac83e53917ebc058066eb98023c11fdaa2262dc (diff) |
net/tun: fix ioctl() based info leaks
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>
Diffstat (limited to 'drivers/net')
-rw-r--r-- | drivers/net/tun.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/net/tun.c b/drivers/net/tun.c index c62163e272c..f55c4622261 100644 --- a/drivers/net/tun.c +++ b/drivers/net/tun.c | |||
@@ -1379,9 +1379,11 @@ static long __tun_chr_ioctl(struct file *file, unsigned int cmd, | |||
1379 | int vnet_hdr_sz; | 1379 | int vnet_hdr_sz; |
1380 | int ret; | 1380 | int ret; |
1381 | 1381 | ||
1382 | if (cmd == TUNSETIFF || _IOC_TYPE(cmd) == 0x89) | 1382 | if (cmd == TUNSETIFF || _IOC_TYPE(cmd) == 0x89) { |
1383 | if (copy_from_user(&ifr, argp, ifreq_len)) | 1383 | if (copy_from_user(&ifr, argp, ifreq_len)) |
1384 | return -EFAULT; | 1384 | return -EFAULT; |
1385 | } else | ||
1386 | memset(&ifr, 0, sizeof(ifr)); | ||
1385 | 1387 | ||
1386 | if (cmd == TUNGETFEATURES) { | 1388 | if (cmd == TUNGETFEATURES) { |
1387 | /* Currently this just means: "what IFF flags are valid?". | 1389 | /* Currently this just means: "what IFF flags are valid?". |