public inbox for passt-dev@passt.top
 help / color / mirror / code / Atom feed
* [PATCH trivial] vu_common: Detach element from virtqueue on invalid TX buffer
@ 2026-03-20 10:38 Laurent Vivier
  0 siblings, 0 replies; only message in thread
From: Laurent Vivier @ 2026-03-20 10:38 UTC (permalink / raw)
  To: passt-dev; +Cc: Laurent Vivier

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.

Call vu_queue_detach_element() before breaking to decrement vq->inuse
and properly release the element.

Signed-off-by: Laurent Vivier <lvivier@redhat.com>
---
 vu_common.c | 1 +
 1 file changed, 1 insertion(+)

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 index,
 
 		if (elem[count].out_num < 1) {
 			warn("virtio-net transmit queue contains no out buffers");
+			vu_queue_detach_element(vq);
 			break;
 		}
 
-- 
2.53.0


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2026-03-20 10:38 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-03-20 10:38 [PATCH trivial] vu_common: Detach element from virtqueue on invalid TX buffer Laurent Vivier

Code repositories for project(s) associated with this public inbox

	https://passt.top/passt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for IMAP folder(s).