Skip to content

Commit

Permalink
VSOCK: Fix missing msg_namelen update in vsock_stream_recvmsg()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
minipli authored and davem330 committed Apr 7, 2013
1 parent 680d04e commit d5e0d0f
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions net/vmw_vsock/af_vsock.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit d5e0d0f

Please sign in to comment.