]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - glsdk/meta-ti-glsdk.git/blob - recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.28/0012-net-tun-fix-ioctl-based-info-leaks.patch
linux-ti33x-psp 3.2: update to 3.2.28 and add motorcape support
[glsdk/meta-ti-glsdk.git] / recipes-kernel / linux / linux-ti33x-psp-3.2 / 3.2.28 / 0012-net-tun-fix-ioctl-based-info-leaks.patch
1 From c45f3d3d8ea33347baec087b5f05f561bbb7e994 Mon Sep 17 00:00:00 2001
2 From: Mathias Krause <minipli@googlemail.com>
3 Date: Sun, 29 Jul 2012 19:45:14 +0000
4 Subject: [PATCH 12/38] net/tun: fix ioctl() based info leaks
6 [ Upstream commits a117dacde0288f3ec60b6e5bcedae8fa37ee0dfc
7   and 8bbb181308bc348e02bfdbebdedd4e4ec9d452ce ]
9 The tun module leaks up to 36 bytes of memory by not fully initializing
10 a structure located on the stack that gets copied to user memory by the
11 TUNGETIFF and SIOCGIFHWADDR ioctl()s.
13 Signed-off-by: Mathias Krause <minipli@googlemail.com>
14 Signed-off-by: David S. Miller <davem@davemloft.net>
15 Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
16 ---
17  drivers/net/tun.c |    6 ++++--
18  1 files changed, 4 insertions(+), 2 deletions(-)
20 diff --git a/drivers/net/tun.c b/drivers/net/tun.c
21 index 7bea9c6..a12c9bf 100644
22 --- a/drivers/net/tun.c
23 +++ b/drivers/net/tun.c
24 @@ -1243,10 +1243,12 @@ static long __tun_chr_ioctl(struct file *file, unsigned int cmd,
25         int vnet_hdr_sz;
26         int ret;
27  
28 -       if (cmd == TUNSETIFF || _IOC_TYPE(cmd) == 0x89)
29 +       if (cmd == TUNSETIFF || _IOC_TYPE(cmd) == 0x89) {
30                 if (copy_from_user(&ifr, argp, ifreq_len))
31                         return -EFAULT;
32 -
33 +       } else {
34 +               memset(&ifr, 0, sizeof(ifr));
35 +       }
36         if (cmd == TUNGETFEATURES) {
37                 /* Currently this just means: "what IFF flags are valid?".
38                  * This is needed because we never checked for invalid flags on
39 -- 
40 1.7.7.6