aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMathias Krause <minipli@googlemail.com>2012-07-29 19:45:14 +0000
committerPaul Gortmaker <paul.gortmaker@windriver.com>2014-02-10 16:10:57 -0500
commitc1968274b39f8e5696baebcba04076678449628d (patch)
tree15a2e16647663cf3b8a6da1f0430b37effe0a71d
parent197365095b482ed4f3ffef8d4534b4708b261137 (diff)
net/tun: fix ioctl() based info leaks
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>
-rw-r--r--drivers/net/tun.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/net/tun.c b/drivers/net/tun.c
index 7b4a88b2f69..c777d8ebdaa 100644
--- a/drivers/net/tun.c
+++ b/drivers/net/tun.c
@@ -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?".