[patch 03/96] net: amend the fix for SO_BSDCOMPAT gsopt infoleak

Greg KH
2009-03-14T00:19:27Z

[-- Attachment #1: net-amend-the-fix-for-so_bsdcompat-gsopt-infoleak.patch --]
[-- Type: text/plain, Size: 1032 bytes --]

2.6.27-stable review patch. If anyone has any objections, please let us know.

------------------

From: Eugene Teo <eugeneteo@kernel.sg>

[ Upstream commit 50fee1dec5d71b8a14c1b82f2f42e16adc227f8b ]

The fix for CVE-2009-0676 (upstream commit df0bca04) is incomplete. Note
that the same problem of leaking kernel memory will reappear if someone
on some architecture uses struct timeval with some internal padding (for
example tv_sec 64-bit and tv_usec 32-bit) --- then, you are going to
leak the padded bytes to userspace.

Signed-off-by: Eugene Teo <eugeneteo@kernel.sg>
Reported-by: Mikulas Patocka <mpatocka@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

---
net/core/sock.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

--- a/net/core/sock.c
+++ b/net/core/sock.c
@@ -695,7 +695,7 @@ int sock_getsockopt(struct socket *sock,
if (len < 0)
return -EINVAL;

- v.val = 0;
+ memset(&v, 0, sizeof(v));

switch(optname) {