lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Mon, 01 Aug 2016 19:18:21 +0200
From:	ggarcia@...a.uab.cat
To:	netdev@...r.kernel.org
Cc:	stefanha@...hat.com, Gerard Garcia <ggarcia@...a.uab.cat>
Subject: [PATCH 1/1] virtio-vsock: Fix unbound rx buffer

From: Gerard Garcia <ggarcia@...c.uab.cat>

Reset connection and close rx socket when the sender is ignoring our announced available buffer.

Signed-off-by: Gerard Garcia <ggarcia@...c.uab.cat>
---
 net/vmw_vsock/virtio_transport_common.c | 22 ++++++++++++++++------
 1 file changed, 16 insertions(+), 6 deletions(-)

diff --git a/net/vmw_vsock/virtio_transport_common.c b/net/vmw_vsock/virtio_transport_common.c
index a53b3a1..3c38d43 100644
--- a/net/vmw_vsock/virtio_transport_common.c
+++ b/net/vmw_vsock/virtio_transport_common.c
@@ -773,13 +773,23 @@ virtio_transport_recv_connected(struct sock *sk,
 		pkt->len = le32_to_cpu(pkt->hdr.len);
 		pkt->off = 0;
 
-		spin_lock_bh(&vvs->rx_lock);
-		virtio_transport_inc_rx_pkt(vvs, pkt);
-		list_add_tail(&pkt->list, &vvs->rx_queue);
-		spin_unlock_bh(&vvs->rx_lock);
+		if (vvs->rx_bytes + pkt->len <= vvs->buf_size) {
+			spin_lock_bh(&vvs->rx_lock);
+			virtio_transport_inc_rx_pkt(vvs, pkt);
+			list_add_tail(&pkt->list, &vvs->rx_queue);
+			spin_unlock_bh(&vvs->rx_lock);
+
+			sk->sk_data_ready(sk);
+			return err;
+		} else {
+			/* Sender is ignoring our buf_alloc */
+			spin_unlock_bh(&vvs->rx_lock);
+
+			virtio_transport_reset(vsk, pkt);
+			virtio_transport_do_close(vsk, true);
+			break;
+		}
 
-		sk->sk_data_ready(sk);
-		return err;
 	case VIRTIO_VSOCK_OP_CREDIT_UPDATE:
 		sk->sk_write_space(sk);
 		break;
-- 
2.9.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ