* [PATCH v1] vhost: fix missing descriptor reclaim on copy_to_iter failure
@ 2025-08-06 11:46 bsdhenrymartin
0 siblings, 0 replies; only message in thread
From: bsdhenrymartin @ 2025-08-06 11:46 UTC (permalink / raw)
To: huntazhang, jitxie, landonsun, mst, jasowang
Cc: eperezma, kvm, virtualization, netdev, linux-kernel,
bsdhenrymartin, Henry Martin, TCS Robot
From: Henry Martin <bsdhenryma@tencent.com>
If copy_to_iter(&hdr, sizeof(hdr), &fixup) fails, the descriptor is not
reclaimed via vhost_discard_vq_desc(), leading to potential resource
leaks.
Fix it by explicitly calling vhost_discard_vq_desc() on failure.
Fixes: 4c5a84421c7d ("vhost: cleanup iterator update logic")
Reported-by: TCS Robot <tcs_robot@tencent.com>
Signed-off-by: Henry Martin <bsdhenryma@tencent.com>
---
drivers/vhost/net.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/vhost/net.c b/drivers/vhost/net.c
index 6edac0c1ba9b..7b4be344b8af 100644
--- a/drivers/vhost/net.c
+++ b/drivers/vhost/net.c
@@ -1238,6 +1238,7 @@ static void handle_rx(struct vhost_net *net)
&fixup) != sizeof(hdr)) {
vq_err(vq, "Unable to write vnet_hdr "
"at addr %p\n", vq->iov->iov_base);
+ vhost_discard_vq_desc(vq, headcount);
goto out;
}
} else {
--
2.41.3
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2025-08-06 11:46 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-06 11:46 [PATCH v1] vhost: fix missing descriptor reclaim on copy_to_iter failure bsdhenrymartin
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 NNTP newsgroup(s).