net/tun: fix ioctl() based info leaks
[ Upstream commitsa117dacde0and8bbb181308] 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: Ben Hutchings <ben@decadent.org.uk>
This commit is contained in:
committed by
Ben Hutchings
parent
789e0ed6c1
commit
9deaafcd3e
@ -1243,10 +1243,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
|
||||
|
||||
Reference in New Issue
Block a user