* [PATCH 6.6 1008/1674] vsock/virtio: fix potential unbounded skb queue
[not found] <20261017160431.119607952@linuxfoundation.org>
@ 2026-10-17 15:54 ` Greg Kroah-Hartman
2026-10-19 13:51 ` Stefano Garzarella
0 siblings, 1 reply; 3+ messages in thread
From: Greg Kroah-Hartman @ 2026-10-17 15:54 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Eric Dumazet, Arseniy Krasnov,
Stefan Hajnoczi, Stefano Garzarella, Michael S. Tsirkin,
Jason Wang, Xuan Zhuo, Eugenio Pérez, virtualization,
Jakub Kicinski, Sasha Levin
6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <edumazet@google.com>
[ Upstream commit 059b7dbd20a6f0c539a45ddff1573cb8946685b5 ]
virtio_transport_inc_rx_pkt() checks vvs->rx_bytes + len > vvs->buf_alloc.
virtio_transport_recv_enqueue() skips coalescing for packets
with VIRTIO_VSOCK_SEQ_EOM.
If fed with packets with len == 0 and VIRTIO_VSOCK_SEQ_EOM,
a very large number of packets can be queued
because vvs->rx_bytes stays at 0.
Fix this by estimating the skb metadata size:
(Number of skbs in the queue) * SKB_TRUESIZE(0)
Fixes: 077706165717 ("virtio/vsock: don't use skbuff state to account credit")
Signed-off-by: Eric Dumazet <edumazet@google.com>
Cc: Arseniy Krasnov <AVKrasnov@sberdevices.ru>
Cc: Stefan Hajnoczi <stefanha@redhat.com>
Cc: Stefano Garzarella <sgarzare@redhat.com>
Cc: "Michael S. Tsirkin" <mst@redhat.com>
Cc: Jason Wang <jasowang@redhat.com>
Cc: Xuan Zhuo <xuanzhuo@linux.alibaba.com>
Cc: "Eugenio Pérez" <eperezma@redhat.com>
Cc: virtualization@lists.linux.dev
Link: https://patch.msgid.link/20260430122653.554058-1-edumazet@google.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
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 e2a5803c0bbb7..24aa9194e6862 100644
--- a/net/vmw_vsock/virtio_transport_common.c
+++ b/net/vmw_vsock/virtio_transport_common.c
@@ -283,7 +283,9 @@ static int virtio_transport_send_pkt_info(struct vsock_sock *vsk,
static bool virtio_transport_inc_rx_pkt(struct virtio_vsock_sock *vvs,
u32 len)
{
- if (vvs->buf_used + len > vvs->buf_alloc)
+ u64 skb_overhead = (skb_queue_len(&vvs->rx_queue) + 1) * SKB_TRUESIZE(0);
+
+ if (skb_overhead + vvs->buf_used + len > vvs->buf_alloc)
return false;
vvs->rx_bytes += len;
--
2.53.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH 6.6 1008/1674] vsock/virtio: fix potential unbounded skb queue
2026-10-17 15:54 ` [PATCH 6.6 1008/1674] vsock/virtio: fix potential unbounded skb queue Greg Kroah-Hartman
@ 2026-10-19 13:51 ` Stefano Garzarella
2026-10-19 16:54 ` Sasha Levin
0 siblings, 1 reply; 3+ messages in thread
From: Stefano Garzarella @ 2026-10-19 13:51 UTC (permalink / raw)
To: Greg Kroah-Hartman
Cc: stable, patches, Eric Dumazet, Arseniy Krasnov, Stefan Hajnoczi,
Michael S. Tsirkin, Jason Wang, Xuan Zhuo, Eugenio Pérez,
virtualization, Jakub Kicinski, Sasha Levin
On Sat, Oct 17, 2026 at 05:54:40PM +0200, Greg Kroah-Hartman wrote:
>6.6-stable review patch. If anyone has any objections, please let me know.
>
>------------------
>
>From: Eric Dumazet <edumazet@google.com>
>
>[ Upstream commit 059b7dbd20a6f0c539a45ddff1573cb8946685b5 ]
Be careful with this patch, this caused data loss. It's fixed upstream
by commits:
a4f0b001782b ("vsock/virtio: reset connection on receiving queue
overflow")
2a12c05aef21 ("vsock/virtio: collapse receive queue under memory
pressure")
c6087c5aaad6 ("vsock/virtio: fix skb overhead accounting to preserve
full buf_alloc")
So if you want to backport this patch, I strongly recommend that you
include these others as well in the same backport.
Thanks,
Stefano
>
>virtio_transport_inc_rx_pkt() checks vvs->rx_bytes + len > vvs->buf_alloc.
>
>virtio_transport_recv_enqueue() skips coalescing for packets
>with VIRTIO_VSOCK_SEQ_EOM.
>
>If fed with packets with len == 0 and VIRTIO_VSOCK_SEQ_EOM,
>a very large number of packets can be queued
>because vvs->rx_bytes stays at 0.
>
>Fix this by estimating the skb metadata size:
>
> (Number of skbs in the queue) * SKB_TRUESIZE(0)
>
>Fixes: 077706165717 ("virtio/vsock: don't use skbuff state to account credit")
>Signed-off-by: Eric Dumazet <edumazet@google.com>
>Cc: Arseniy Krasnov <AVKrasnov@sberdevices.ru>
>Cc: Stefan Hajnoczi <stefanha@redhat.com>
>Cc: Stefano Garzarella <sgarzare@redhat.com>
>Cc: "Michael S. Tsirkin" <mst@redhat.com>
>Cc: Jason Wang <jasowang@redhat.com>
>Cc: Xuan Zhuo <xuanzhuo@linux.alibaba.com>
>Cc: "Eugenio Pérez" <eperezma@redhat.com>
>Cc: virtualization@lists.linux.dev
>Link: https://patch.msgid.link/20260430122653.554058-1-edumazet@google.com
>Signed-off-by: Jakub Kicinski <kuba@kernel.org>
>Signed-off-by: Sasha Levin <sashal@kernel.org>
>---
> 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 e2a5803c0bbb7..24aa9194e6862 100644
>--- a/net/vmw_vsock/virtio_transport_common.c
>+++ b/net/vmw_vsock/virtio_transport_common.c
>@@ -283,7 +283,9 @@ static int virtio_transport_send_pkt_info(struct vsock_sock *vsk,
> static bool virtio_transport_inc_rx_pkt(struct virtio_vsock_sock *vvs,
> u32 len)
> {
>- if (vvs->buf_used + len > vvs->buf_alloc)
>+ u64 skb_overhead = (skb_queue_len(&vvs->rx_queue) + 1) * SKB_TRUESIZE(0);
>+
>+ if (skb_overhead + vvs->buf_used + len > vvs->buf_alloc)
> return false;
>
> vvs->rx_bytes += len;
>--
>2.53.0
>
>
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH 6.6 1008/1674] vsock/virtio: fix potential unbounded skb queue
2026-10-19 13:51 ` Stefano Garzarella
@ 2026-10-19 16:54 ` Sasha Levin
0 siblings, 0 replies; 3+ messages in thread
From: Sasha Levin @ 2026-10-19 16:54 UTC (permalink / raw)
To: Stefano Garzarella
Cc: Sasha Levin, Greg Kroah-Hartman, stable, patches, Eric Dumazet,
Arseniy Krasnov, Stefan Hajnoczi, Michael S. Tsirkin, Jason Wang,
Xuan Zhuo, Eugenio Pérez, virtualization, Jakub Kicinski
On Mon, Oct 19, 2026 at 03:51:21PM +0200, Stefano Garzarella wrote:
> Be careful with this patch, this caused data loss. It's fixed upstream
> by commits:
[...]
> So if you want to backport this patch, I strongly recommend that you
> include these others as well in the same backport.
Thanks. I dropped 059b7dbd20a6 ("vsock/virtio: fix potential unbounded
skb queue") from the 6.6 queue, together with its two prerequisites that
were queued only for it:
- 0df7cd3c13e4 ("vsock/virtio/vhost: read data from non-linear skb")
- 45ca7e9f0730 ("vsock/virtio: fix `rx_bytes` accounting for stream
sockets")
It is dropped from 6.1 as well. If it comes back to 6.6, it will be with
the complete set of fixes.
--
Thanks,
Sasha
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-10-19 16:54 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <20261017160431.119607952@linuxfoundation.org>
2026-10-17 15:54 ` [PATCH 6.6 1008/1674] vsock/virtio: fix potential unbounded skb queue Greg Kroah-Hartman
2026-10-19 13:51 ` Stefano Garzarella
2026-10-19 16:54 ` Sasha Levin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox