From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: passt.top; dmarc=none (p=none dis=none) header.from=gibson.dropbear.id.au Authentication-Results: passt.top; dkim=pass (2048-bit key; secure) header.d=gibson.dropbear.id.au header.i=@gibson.dropbear.id.au header.a=rsa-sha256 header.s=202602 header.b=SsU8T80k; dkim-atps=neutral Received: from mail.ozlabs.org (gandalf.ozlabs.org [150.107.74.76]) by passt.top (Postfix) with ESMTPS id 217585A0627 for ; Mon, 23 Mar 2026 23:55:58 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gibson.dropbear.id.au; s=202602; t=1774306555; bh=r6R4W6k9Wm1bDHOviruZk45nMXDyxEeIhksLiLLme7w=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=SsU8T80klRLLmS75oLH5pdyP8+810iksMbewMZ7TKkWfrflBq4xqP1Fw3cBZMQJOv NY1aySqQM0MTg3B45fPo6tW72y4yBFtp4KjBqDBFQCpqFyNyg4XS2/bkVEYc05HtJd z2g5WTYPwgm/byk7fFUkfrTXLYAcTqd8iPdojAxhZn9zu5nRO6D/+uWPSQCvIUnWZG DDb+AVeaiBdGzHTcscZCNGdWF1daIn0qtYkWj+M7qoRHlGSjpTT3sIrf6Y4owFL+Ep PvNUdMUv+FFheSVYPt76gFRp++wDCH1cDvUy7nG3GT7SRPAGnzBErPw0j5lnWk0Gdw mtj914SYOT/ew== Received: by gandalf.ozlabs.org (Postfix, from userid 1007) id 4ffpRv0TTmz4wF0; Tue, 24 Mar 2026 09:55:55 +1100 (AEDT) Date: Tue, 24 Mar 2026 09:55:46 +1100 From: David Gibson To: Laurent Vivier Subject: Re: [PATCH trivial] vu_common: Detach element from virtqueue on invalid TX buffer Message-ID: References: <20260320103848.204147-1-lvivier@redhat.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="JJLuTc88U30DWpKy" Content-Disposition: inline In-Reply-To: <20260320103848.204147-1-lvivier@redhat.com> Message-ID-Hash: FRMXCBOZXHNSRYVMOBTIX5SEHX2GILMV X-Message-ID-Hash: FRMXCBOZXHNSRYVMOBTIX5SEHX2GILMV X-MailFrom: dgibson@gandalf.ozlabs.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: passt-dev@passt.top X-Mailman-Version: 3.3.8 Precedence: list List-Id: Development discussion and patches for passt Archived-At: Archived-At: List-Archive: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: --JJLuTc88U30DWpKy Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Mar 20, 2026 at 11:38:48AM +0100, Laurent Vivier wrote: > When vu_queue_pop() succeeds but the element contains no out buffers, > we warn and break out of the TX loop. However, vu_queue_pop() already > incremented vq->inuse for this element. Since we don't add it to the > count of elements to be filled and flushed back to the guest, the > inuse counter is left inconsistent. >=20 > Call vu_queue_detach_element() before breaking to decrement vq->inuse > and properly release the element. >=20 > Signed-off-by: Laurent Vivier Reviewed-by: David Gibson > --- > vu_common.c | 1 + > 1 file changed, 1 insertion(+) >=20 > diff --git a/vu_common.c b/vu_common.c > index 5f2ce18e5b71..ff8f1c046026 100644 > --- a/vu_common.c > +++ b/vu_common.c > @@ -190,6 +190,7 @@ static void vu_handle_tx(struct vu_dev *vdev, int ind= ex, > =20 > if (elem[count].out_num < 1) { > warn("virtio-net transmit queue contains no out buffers"); > + vu_queue_detach_element(vq); > break; > } > =20 > --=20 > 2.53.0 >=20 --=20 David Gibson (he or they) | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you, not the other way | around. http://www.ozlabs.org/~dgibson --JJLuTc88U30DWpKy Content-Type: application/pgp-signature; name=signature.asc -----BEGIN PGP SIGNATURE----- iQIzBAEBCgAdFiEEO+dNsU4E3yXUXRK2zQJF27ox2GcFAmnBxPEACgkQzQJF27ox 2GePHA/+IPgBPYOYzNRE8wmKmfilhb3FSJkxVdoLCKGY6RJYRe7x0Z8+z9Nuu0xi 0w6xwE1Zx/9w+L2NPNU9ULIXl2MJCnI3WC9rq9q88/lWTdAfU4Su+DH+SokNRJIl 4U9G9s/olEysc3lgehKRrk57pZHJZt67k3Vhb2djScwyuROXyAyZcKp8fGN0mvrX +p2psJfIP87MJ/wGIs6XL+TAnwGdf7qSzc+s/IJws0SAsphx35JtaLJ68pfLbVMh 4+DXxgJoY6bQ+bvNJaVF7szQ14MiLH4mKXb7d+Cx9c/BWwgWgY3sY0271ryqzL32 ATXba+8Kli/OiOK9JDBff2qu1F/BYltJ0hM5JIbpIGgxPsmeuzJpuJ6W3+KuulVX kMaTTqnUx9iMRchtfhcDoyJIkmgTtlmRJeQAiF2mth1i8iynt3/eaWl1CsY+rZF4 TjIJ4433RXUpZMdfF5+ZcFCVWKpOSaw7Ni/VmlzvAPXaAilnQeerI5J6YZdLCzVf DZ5nAhI1bfqP26spwlhmt9fBPvZjif3Gou+b0XYfV6PUoK92h+8AX2KnC43xV5tl 9wg5Qj2VCydM+tAZJSbgys/7WuiKQg53BaWo/dOpjIGQHkVmAWBnNIYw1+in351Y PKF+WMjjy2Rjlr1PwgOU31HjNqNg5jQXnY3863PaEEa//THqpEI= =Nmvm -----END PGP SIGNATURE----- --JJLuTc88U30DWpKy--