aboutsummaryrefslogtreecommitdiff
path: root/hw/virtio
diff options
context:
space:
mode:
authorYajun Wu <yajunw@nvidia.com>2021-08-16 04:32:35 +0300
committerMichael S. Tsirkin <mst@redhat.com>2021-09-04 09:07:45 -0400
commit1f89d3b91e3e222e468d98057f5eaf8ebac0e7bf (patch)
treed6112e21069b190771b361aaa797d54ef70c7193 /hw/virtio
parente6db5df7e2c6e64846f47a6785a9a67f08574790 (diff)
downloadqemu-1f89d3b91e3e222e468d98057f5eaf8ebac0e7bf.zip
qemu-1f89d3b91e3e222e468d98057f5eaf8ebac0e7bf.tar.gz
qemu-1f89d3b91e3e222e468d98057f5eaf8ebac0e7bf.tar.bz2
hw/virtio: Fix leak of host-notifier memory-region
If call virtio_queue_set_host_notifier_mr fails, should free host-notifier memory-region. Fixes: 44866521bd ("vhost-user: support registering external host notifiers") Signed-off-by: Yajun Wu <yajunw@nvidia.com> Message-Id: <1629077555-19907-1-git-send-email-yajunw@nvidia.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Diffstat (limited to 'hw/virtio')
-rw-r--r--hw/virtio/vhost-user.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/hw/virtio/vhost-user.c b/hw/virtio/vhost-user.c
index 2407836..3300230 100644
--- a/hw/virtio/vhost-user.c
+++ b/hw/virtio/vhost-user.c
@@ -1474,6 +1474,7 @@ static int vhost_user_slave_handle_vring_host_notifier(struct vhost_dev *dev,
g_free(name);
if (virtio_queue_set_host_notifier_mr(vdev, queue_idx, &n->mr, true)) {
+ object_unparent(OBJECT(&n->mr));
munmap(addr, page_size);
return -1;
}