public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] vsock/virtio: fix accept queue count leak on transport mismatch in recv_listen
@ 2026-04-13  8:52 Dudu Lu
  2026-04-13 10:30 ` Stefano Garzarella
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Dudu Lu @ 2026-04-13  8:52 UTC (permalink / raw)
  To: netdev; +Cc: stefanha, sgarzare, mst, jasowang, Dudu Lu

virtio_transport_recv_listen() calls sk_acceptq_added(sk) to increment
the listener's accept queue counter before calling
vsock_assign_transport(). When vsock_assign_transport() fails or selects
a different transport than the one that received the packet, the error
path returns without calling sk_acceptq_removed(sk), permanently
incrementing sk_ack_backlog.

A malicious VM peer can exploit this by sending repeated CONNECT
requests that trigger the transport mismatch condition. Each such
request permanently increments sk_ack_backlog. After approximately
backlog+1 such requests (default backlog ~128), sk_acceptq_is_full()
returns true, causing the listener to reject ALL new connections with
-ENOMEM. The only recovery is closing and re-creating the listener
socket.

Compare with vmci_transport.c and hyperv_transport.c which correctly
place sk_acceptq_added() AFTER the transport check, avoiding this
issue entirely.

Fix by moving sk_acceptq_added(sk) to after the transport validation
check, matching the pattern used by the other transports.

Fixes: c0cfa2d8a788 ("vsock: add multi-transports support")
Signed-off-by: Dudu Lu <phx0fer@gmail.com>
---
 net/vmw_vsock/virtio_transport_common.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/net/vmw_vsock/virtio_transport_common.c b/net/vmw_vsock/virtio_transport_common.c
index 8a9fb23c6e85..29e1d9833be4 100644
--- a/net/vmw_vsock/virtio_transport_common.c
+++ b/net/vmw_vsock/virtio_transport_common.c
@@ -1,3 +1,4 @@
+	sk_acceptq_added(sk);
 // SPDX-License-Identifier: GPL-2.0-only
 /*
  * common code for virtio vsock
@@ -1560,8 +1561,9 @@ virtio_transport_recv_listen(struct sock *sk, struct sk_buff *skb,
 		return -ENOMEM;
 	}
 
-	sk_acceptq_added(sk);
 
+
+	sk_acceptq_added(sk);
 	lock_sock_nested(child, SINGLE_DEPTH_NESTING);
 
 	child->sk_state = TCP_ESTABLISHED;
-- 
2.39.3 (Apple Git-145)


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-04-15  0:05 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-13  8:52 [PATCH] vsock/virtio: fix accept queue count leak on transport mismatch in recv_listen Dudu Lu
2026-04-13 10:30 ` Stefano Garzarella
2026-04-14 23:40 ` kernel test robot
2026-04-15  0:04 ` kernel test robot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox