From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DDE763E0091; Fri, 15 May 2026 16:16:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778861803; cv=none; b=aKh+W2HwFir3epG5meqHKl7ogY18IfFpX9dSqadQEGcEj2FkY84L2PdiOPL873nPGtw6+nKYwGNC3Na3y/EE90/k+u4AjtnhPGukXO0nD9Kl+GetOflUJNNZX5umKgr9b2Z/000WmzuIRW9vRwkyfe7rzNqt6VrMu7nrzLIms5I= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778861803; c=relaxed/simple; bh=0L4pScPUyIT0tCQ8XyF3Dw7v1MBs4nt9C55wNiBLG7o=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=ujbZa0q2YbrIYN+MetsgElXgiEIdq+VlcY15G0y3RPG3LopUKGm2o9epd0vQS86Mow2XAVx/qpNu4L+4zHccsuR7dYUOpnXDh3SW3BrLEHJOcb7wWHyjxf0baU6VGaXKARNNprGw5WZB6oq8i3oxH1i77v2aa6WEWbsOWgEFBGM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=v6GeyY53; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="v6GeyY53" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4DCF2C2BCB3; Fri, 15 May 2026 16:16:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1778861803; bh=0L4pScPUyIT0tCQ8XyF3Dw7v1MBs4nt9C55wNiBLG7o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=v6GeyY53Zy4JBo3ea/K8G/W1oV2+63mqQb5h3yZWU2lyuAeybpNo4iWvxX2m0N4Kd qMdUkJDFM+Zv5rnT09CWHKwWUBQjhQ/j2Pv+VBwOsntrvy+4Fb+VmX92dLT8K+71At kcAdXtc9AF/fVYJKAOXiAMbqRM8mSzL5ptJUY23E= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Eric Dumazet , Arseniy Krasnov , Stefan Hajnoczi , Stefano Garzarella , "Michael S. Tsirkin" , Jason Wang , Xuan Zhuo , =?UTF-8?q?Eugenio=20P=C3=A9rez?= , virtualization@lists.linux.dev, Jakub Kicinski , Luigi Leonardi Subject: [PATCH 6.6 467/474] vsock/virtio: fix potential unbounded skb queue Date: Fri, 15 May 2026 17:49:36 +0200 Message-ID: <20260515154725.211770846@linuxfoundation.org> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260515154715.053014143@linuxfoundation.org> References: <20260515154715.053014143@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 6.6-stable review patch. If anyone has any objections, please let me know. ------------------ From: Eric Dumazet commit 059b7dbd20a6f0c539a45ddff1573cb8946685b5 upstream. 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 Cc: Arseniy Krasnov Cc: Stefan Hajnoczi Cc: Stefano Garzarella Cc: "Michael S. Tsirkin" Cc: Jason Wang Cc: Xuan Zhuo Cc: "Eugenio Pérez" Cc: virtualization@lists.linux.dev Link: https://patch.msgid.link/20260430122653.554058-1-edumazet@google.com Signed-off-by: Jakub Kicinski [LL: Fixed conflict since this tree does not use buf_used added by commit 45ca7e9f0730 ("vsock/virtio: fix `rx_bytes` accounting for stream sockets")] Signed-off-by: Luigi Leonardi Signed-off-by: Greg Kroah-Hartman --- net/vmw_vsock/virtio_transport_common.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) --- 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_inf static bool virtio_transport_inc_rx_pkt(struct virtio_vsock_sock *vvs, u32 len) { - if (vvs->rx_bytes + len > vvs->buf_alloc) + u64 skb_overhead = (skb_queue_len(&vvs->rx_queue) + 1) * SKB_TRUESIZE(0); + + if (skb_overhead + vvs->rx_bytes + len > vvs->buf_alloc) return false; vvs->rx_bytes += len;