From: Mathias Krause Date: Wed, 15 Aug 2012 11:31:57 +0000 (+0000) Subject: net: fix info leak in compat dev_ifconf() X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=43da5f2e0d0c69ded3d51907d9552310a6b545e8;p=GitHub%2FLineageOS%2Fandroid_kernel_samsung_universal7580.git net: fix info leak in compat dev_ifconf() 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 --- diff --git a/net/socket.c b/net/socket.c index dfe5b66c97e..a5471f804d9 100644 --- a/net/socket.c +++ b/net/socket.c @@ -2657,6 +2657,7 @@ static int dev_ifconf(struct net *net, struct compat_ifconf __user *uifc32) if (copy_from_user(&ifc32, uifc32, sizeof(struct compat_ifconf))) return -EFAULT; + memset(&ifc, 0, sizeof(ifc)); if (ifc32.ifcbuf == 0) { ifc32.ifc_len = 0; ifc.ifc_len = 0;