net: tipc: fix information leak to userland
authorKulikov Vasiliy <[email protected]>
Sun, 31 Oct 2010 07:10:32 +0000 (07:10 +0000)
committerDavid S. Miller <[email protected]>
Tue, 9 Nov 2010 17:25:46 +0000 (09:25 -0800)
Structure sockaddr_tipc is copied to userland with padding bytes after
"id" field in union field "name" unitialized.  It leads to leaking of
contents of kernel stack memory.  We have to initialize them to zero.

Signed-off-by: Vasiliy Kulikov <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
net/tipc/socket.c

index 33217fc3d697436cc5a82643a9d1fecb0986aac0..e9f0d500448341e0981fbb742b9fa098dc83a8ce 100644 (file)
@@ -396,6 +396,7 @@ static int get_name(struct socket *sock, struct sockaddr *uaddr,
        struct sockaddr_tipc *addr = (struct sockaddr_tipc *)uaddr;
        struct tipc_sock *tsock = tipc_sk(sock->sk);
 
+       memset(addr, 0, sizeof(*addr));
        if (peer) {
                if ((sock->state != SS_CONNECTED) &&
                        ((peer != 2) || (sock->state != SS_DISCONNECTING)))