Patchwork [16/16] VSOCK: Fix missing msg_namelen update in vsock_stream_recvmsg()

login
register
mail settings
Submitter Mathias Krause
Date April 7, 2013, 11:52 a.m.
Message ID <1365335522-29931-17-git-send-email-minipli@googlemail.com>
Download mbox | patch
Permalink /patch/234489/
State Accepted
Delegated to: David Miller
Headers show

Comments

Mathias Krause - April 7, 2013, 11:52 a.m.
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>
---
 net/vmw_vsock/af_vsock.c |    2 ++
 1 file changed, 2 insertions(+)

Patch

diff --git a/net/vmw_vsock/af_vsock.c b/net/vmw_vsock/af_vsock.c
index ca511c4..08a228d 100644
--- a/net/vmw_vsock/af_vsock.c
+++ b/net/vmw_vsock/af_vsock.c
@@ -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) {