aboutsummaryrefslogtreecommitdiffstats
path: root/net/vmw_vsock
diff options
context:
space:
mode:
authorMathias Krause <minipli@googlemail.com>2013-04-06 21:52:01 -0400
committerDavid S. Miller <davem@davemloft.net>2013-04-07 16:28:02 -0400
commit680d04e0ba7e926233e3b9cee59125ce181f66ba (patch)
treebd075aa2f2b87d1b6f019baaee2cbb89cb4ba388 /net/vmw_vsock
parent60085c3d009b0df252547adb336d1ccca5ce52ec (diff)
VSOCK: vmci - fix possible info leak in vmci_transport_dgram_dequeue()
In case we received no data on the call to skb_recv_datagram(), i.e. skb->data is NULL, vmci_transport_dgram_dequeue() will return with 0 without updating msg_namelen leading to net/socket.c leaking the local, uninitialized sockaddr_storage variable to userland -- 128 bytes of kernel stack memory. Fix this by moving the already existing msg_namelen assignment a few lines above. 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>
Diffstat (limited to 'net/vmw_vsock')
-rw-r--r--net/vmw_vsock/vmci_transport.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/net/vmw_vsock/vmci_transport.c b/net/vmw_vsock/vmci_transport.c
index 1f6508e249ae..5e04d3d96285 100644
--- a/net/vmw_vsock/vmci_transport.c
+++ b/net/vmw_vsock/vmci_transport.c
@@ -1736,6 +1736,8 @@ static int vmci_transport_dgram_dequeue(struct kiocb *kiocb,
1736 if (flags & MSG_OOB || flags & MSG_ERRQUEUE) 1736 if (flags & MSG_OOB || flags & MSG_ERRQUEUE)
1737 return -EOPNOTSUPP; 1737 return -EOPNOTSUPP;
1738 1738
1739 msg->msg_namelen = 0;
1740
1739 /* Retrieve the head sk_buff from the socket's receive queue. */ 1741 /* Retrieve the head sk_buff from the socket's receive queue. */
1740 err = 0; 1742 err = 0;
1741 skb = skb_recv_datagram(&vsk->sk, flags, noblock, &err); 1743 skb = skb_recv_datagram(&vsk->sk, flags, noblock, &err);
@@ -1768,7 +1770,6 @@ static int vmci_transport_dgram_dequeue(struct kiocb *kiocb,
1768 if (err) 1770 if (err)
1769 goto out; 1771 goto out;
1770 1772
1771 msg->msg_namelen = 0;
1772 if (msg->msg_name) { 1773 if (msg->msg_name) {
1773 struct sockaddr_vm *vm_addr; 1774 struct sockaddr_vm *vm_addr;
1774 1775