VSOCK: Fix missing msg_namelen update in vsock_stream_recvmsg()
authorMathias Krause <minipli@googlemail.com>
Sun, 7 Apr 2013 01:52:02 +0000 (01:52 +0000)
committerDavid S. Miller <davem@davemloft.net>
Sun, 7 Apr 2013 20:28:02 +0000 (16:28 -0400)
The code misses to update the msg_namelen member to 0 and therefore
makes net/socket.c leak the local, uninitialized sockaddr_storage
variable to userland -- 128 bytes of kernel stack memory.

Cc: Andy King <acking@vmware.com>
Cc: Dmitry Torokhov <dtor@vmware.com>
Cc: George Zhang <georgezhang@vmware.com>
Signed-off-by: Mathias Krause <minipli@googlemail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/vmw_vsock/af_vsock.c

index d8079daf1bdeaed0f341aaac673c8b9e1da7d96b..7f93e2a42d7a57f0cbdbe2305c942cce7b544d1b 100644 (file)
@@ -1670,6 +1670,8 @@ vsock_stream_recvmsg(struct kiocb *kiocb,
        vsk = vsock_sk(sk);
        err = 0;
 
+       msg->msg_namelen = 0;
+
        lock_sock(sk);
 
        if (sk->sk_state != SS_CONNECTED) {