From: David Gibson <david@gibson.dropbear.id.au>
To: Laurent Vivier <lvivier@redhat.com>
Cc: passt-dev@passt.top
Subject: Re: [PATCH trivial] vu_common: Detach element from virtqueue on invalid TX buffer
Date: Tue, 24 Mar 2026 09:55:46 +1100 [thread overview]
Message-ID: <acHE8tdEd_U4id-F@zatzit> (raw)
In-Reply-To: <20260320103848.204147-1-lvivier@redhat.com>
[-- Attachment #1: Type: text/plain, Size: 1291 bytes --]
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.
>
> Call vu_queue_detach_element() before breaking to decrement vq->inuse
> and properly release the element.
>
> Signed-off-by: Laurent Vivier <lvivier@redhat.com>
Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
> ---
> 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
>
--
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
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
prev parent reply other threads:[~2026-03-23 22:55 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-20 10:38 Laurent Vivier
2026-03-23 22:55 ` David Gibson [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=acHE8tdEd_U4id-F@zatzit \
--to=david@gibson.dropbear.id.au \
--cc=lvivier@redhat.com \
--cc=passt-dev@passt.top \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).