From: Mathias Krause Date: Wed, 15 Aug 2012 11:31:57 +0000 (+0000) Subject: net: fix info leak in compat dev_ifconf() X-Git-Tag: v2.6.32.61~31 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=66096e8915ce1ff5daa23362dc890651b160be7d;p=people%2Fms%2Flinux.git net: fix info leak in compat dev_ifconf() commit 43da5f2e0d0c69ded3d51907d9552310a6b545e8 upstream. The implementation of dev_ifconf() for the compat ioctl interface uses an intermediate ifc structure allocated in userland for the duration of the syscall. Though, it fails to initialize the padding bytes inserted for alignment and that for leaks four bytes of kernel stack. Add an explicit memset(0) before filling the structure to avoid the info leak. Signed-off-by: Mathias Krause Signed-off-by: David S. Miller [bwh: Backported to 2.6.32: adjust filename, context] Signed-off-by: Willy Tarreau --- diff --git a/fs/compat_ioctl.c b/fs/compat_ioctl.c index 0dd21a425973..98d3c581a4bc 100644 --- a/fs/compat_ioctl.c +++ b/fs/compat_ioctl.c @@ -352,6 +352,7 @@ static int dev_ifconf(unsigned int fd, unsigned int cmd, unsigned long arg) if (copy_from_user(&ifc32, compat_ptr(arg), sizeof(struct ifconf32))) return -EFAULT; + memset(&ifc, 0, sizeof(ifc)); if (ifc32.ifcbuf == 0) { ifc32.ifc_len = 0; ifc.ifc_len = 0;