This is an automated email from the ASF dual-hosted git repository.
xiaoxiang781216 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git
The following commit(s) were added to refs/heads/master by this push:
new f5eefbba108 drivers/virtio: Free rng buffer on queue failure
f5eefbba108 is described below
commit f5eefbba1084e6a0d367f862c0659d55ca2a5274
Author: chao an <[email protected]>
AuthorDate: Wed Oct 28 15:26:52 2026 +0800
drivers/virtio: Free rng buffer on queue failure
virtio_rng_read() allocates a DMA buffer before submitting it to the
virtqueue.
If virtqueue_add_buffer() fails, return through the same cleanup path for
that
buffer instead of leaking it.
Signed-off-by: chao an <[email protected]>
---
drivers/virtio/virtio-rng.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/virtio/virtio-rng.c b/drivers/virtio/virtio-rng.c
index aa84c31c1fc..77d91478d64 100644
--- a/drivers/virtio/virtio-rng.c
+++ b/drivers/virtio/virtio-rng.c
@@ -176,6 +176,7 @@ static ssize_t virtio_rng_read(FAR struct file *filep, FAR
char *buffer,
if (ret < 0)
{
spin_unlock_irqrestore(&priv->lock, flags);
+ virtio_free_buf(priv->vdev, vb.buf);
return ret;
}