From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796221417; b=AsiW3Ap3CbvCO7PDNRx4ZcYsoHo7OJvmiqxHK2bAHQqZlsNlJ3g+n3ZkTutsqzkXvlAa 7p50E8waLMvoSJYoABiVnl5zfRSBp6YOgqa8DOLubRFp/0P+QPq0+tv6RS6ZOoFSmoA0z Xp+bXXv8bxUgYZb0FtH1nts8DHldugRD5PJPSTSMpGycd2F2puT/dtZSx7hyWzgbNmwGk v9pisDZ38Ar1CRSNYmuTnThqAXNQrwn5ypcM6YvZOAZkhWFhmONyVNAwd2F9s2yxK1zL4 349qODyI6Kx+xqwDvU1SdR6/y4AjUF98YTBOs60dkaNP9lzOKEZS4F+5b88weUR6pJg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796221417; h=Received:DKIM-Signature:Subject:To:Cc:From:Date:Message-ID: MIME-Version:Content-Type:Content-Transfer-Encoding; bh=MAAhGRU5kZhjYWoeWMboKcWUvlVwnEgsE6nnJL+q0GY=; b=n20N3nvDLYUBvRJTPndlkGkDd8ibeh9SaS5kdi0sgkRbXlEaqfxjskEwNmwy1sn6ckDn f6G1Ugb+vsQH/KDSi0xhL3hyewHv5jf8HyH7x96FhJisVNIoyz3+Q0bGUgzEl4RbieIiF vxJ1x44vqGjx+9t47EPDymB0whwxsQ+ZYTAvm4ozMB84PioQ3aJBgt1PZOtcYCB2bb/NG mT8P5/F37Lq/VBYS4I4tTeurdOIO2Wa0ZnxloWc+mZE5MWm3dhbc4dDDrofSogkW3Ys9R fvY43rlFs55A7p44dD53NIiAORvtySHWg6HJXKEu8l//gAhAg26RhZTzrmcaql2CteQ== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=x7wytDWS; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6DC29606A31A for ; Wed, 2 Dec 2026 14:23:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=x7wytDWS Received: by smtp.kernel.org (Postfix) with ESMTPSA id 443FF1F000C1; Wed, 2 Dec 2026 14:23:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796221416; bh=MAAhGRU5kZhjYWoeWMboKcWUvlVwnEgsE6nnJL+q0GY=; h=Subject:To:Cc:From:Date; b=x7wytDWSIllsODLhJARoKCZcdihWigK685R+DnBtI/KD0+hVQHeF0gNUuUeI96I13 DeoF7jsK5Hd0UNJdxGGFZhmgErdEllJPp672xMjVQXZReeDpM6SRDh8BcGDVOqFkvJ Mah36hHp5yVF6BC2U/lVineCzuF8AssJE7wmPADs= Subject: FAILED: patch "[PATCH] vhost: split out-of-order used ring batches at every wrap" failed to apply to 6.12-stable tree To: mst@redhat.com,bioloidgp@gmail.com,jasowangio@gmail.com Cc: From: Date: Wed, 02 Dec 2026 14:46:19 +0100 Message-ID: <2026120219-sassy-entering-757d@gregkh> X-Mailing-List: stable@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=ANSI_X3.4-1968 Content-Transfer-Encoding: 8bit The patch below does not apply to the 6.12-stable tree. If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to . To reproduce the conflict and resubmit, you may use the following commands: git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-6.12.y git checkout FETCH_HEAD git cherry-pick -x 5570a998b884c988dbe105430d7e2d8e9411e37e # git commit -s git send-email --to '' --in-reply-to '2026120219-sassy-entering-757d@gregkh' --subject-prefix 'PATCH 6.12.y' 'HEAD^..' Possible dependencies: thanks, greg k-h ------------------ original commit in Linus's tree ------------------ >From 5570a998b884c988dbe105430d7e2d8e9411e37e Mon Sep 17 00:00:00 2001 From: "Michael S. Tsirkin" Date: Fri, 6 Nov 2026 09:11:07 -0500 Subject: [PATCH] vhost: split out-of-order used ring batches at every wrap When a completion batch larger than the remaining space in the used ring is added without VIRTIO_F_IN_ORDER, vhost_add_used_n_ooo() splits it at the ring boundary only once. vhost-net can batch up to VHOST_NET_BATCH TX completions, so with a queue smaller than half the batch the tail of the second chunk runs past the end of the used ring and into whatever follows it in the vhost owner's address space: with a 32 entry queue, last_used_idx % 32 == 3 and a 64 entry batch, three used entries are written past the ring. To fix, keep splitting the remaining batch at each wrap until it is exhausted. Cc: stable@vger.kernel.org Reported-by: Seohyeon Maeng Cc: minki@morningstarsec.dev Fixes: 2b3b35eb989 ("vhost_net: batch used ring update in rx") Fixes: 4afb52c2af44 ("vhost_net: batch update used ring for datacopy TX") Cc: Jason Wang Signed-off-by: Michael S. Tsirkin diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c index ea127af58ada..ce80f7cbc224 100644 --- a/drivers/vhost/vhost.c +++ b/drivers/vhost/vhost.c @@ -3153,18 +3153,21 @@ static int vhost_add_used_n_ooo(struct vhost_virtqueue *vq, struct vring_used_elem *heads, unsigned count) { - int start, n, r; + unsigned int n; + int r; - start = vq->last_used_idx & (vq->num - 1); - n = vq->num - start; - if (n < count) { + do { + unsigned int start = vq->last_used_idx & (vq->num - 1); + + n = min(vq->num - start, count); r = __vhost_add_used_n(vq, heads, n); if (r < 0) return r; heads += n; count -= n; - } - return __vhost_add_used_n(vq, heads, count); + } while (count); + + return 0; } static int vhost_add_used_n_in_order(struct vhost_virtqueue *vq,