From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: passt.top; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: passt.top; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=cIVXN90j; dkim-atps=neutral Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by passt.top (Postfix) with ESMTPS id 5CA7D5A0272 for ; Fri, 20 Mar 2026 11:38:54 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1774003133; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=JfGSHN1Ej7D+cJhHxI17ErdSQOlPeCxgqKvanlRU/tw=; b=cIVXN90jGgrkCeevbMjdjqCnZnFsucXLg5f8GIeyY9RVkLER4Swv8BGg4OVcoqkQkmXBU6 8jAJcr8bFlW8Hte6e9Crjc8rb0z95iobTAzfAbCjj3ABU1MgrawTY9ZxoTUcW+lJIMCWER x7XMcwD3ShlL2YflwVYezJYQS8vcktM= Received: from mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-177-73KTlQsCO3mTLo2YyomEZQ-1; Fri, 20 Mar 2026 06:38:51 -0400 X-MC-Unique: 73KTlQsCO3mTLo2YyomEZQ-1 X-Mimecast-MFC-AGG-ID: 73KTlQsCO3mTLo2YyomEZQ_1774003130 Received: from mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.12]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id CA50F180049D for ; Fri, 20 Mar 2026 10:38:50 +0000 (UTC) Received: from lenovo-t14s.redhat.com (unknown [10.45.224.233]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id CB7C21955F25; Fri, 20 Mar 2026 10:38:49 +0000 (UTC) From: Laurent Vivier To: passt-dev@passt.top Subject: [PATCH trivial] vu_common: Detach element from virtqueue on invalid TX buffer Date: Fri, 20 Mar 2026 11:38:48 +0100 Message-ID: <20260320103848.204147-1-lvivier@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.12 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: Af6A89lSFkm_gBZlabm7G22g2WgnDhnprJxTqjyOTns_1774003130 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit content-type: text/plain; charset="US-ASCII"; x-default=true Message-ID-Hash: WXVFYCQ4QPPLHMY5ANSWNQMUUEADZUNM X-Message-ID-Hash: WXVFYCQ4QPPLHMY5ANSWNQMUUEADZUNM X-MailFrom: lvivier@redhat.com 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: Laurent Vivier 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: 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 --- 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