thebeanogamer / rpms / qemu-kvm

Forked from rpms/qemu-kvm 6 months ago
Clone

Blame SOURCES/kvm-hw-virtio-vdpa-Fix-leak-of-host-notifier-memory-regi.patch

495e37
From 2005e3bb97fba4889829b58331a057b9cb35a65d Mon Sep 17 00:00:00 2001
495e37
From: Laurent Vivier <lvivier@redhat.com>
495e37
Date: Fri, 11 Feb 2022 18:02:59 +0100
495e37
Subject: [PATCH 2/5] hw/virtio: vdpa: Fix leak of host-notifier memory-region
495e37
495e37
RH-Author: Laurent Vivier <lvivier@redhat.com>
495e37
RH-MergeRequest: 123: hw/virtio: vdpa: Fix leak of host-notifier memory-region
495e37
RH-Commit: [1/1] ddd64cac5c29786edf652f5fa97767b261ccfcdd
495e37
RH-Bugzilla: 2059786
495e37
RH-Acked-by: Jason Wang <jasowang@redhat.com>
495e37
RH-Acked-by: Cindy Lu <lulu@redhat.com>
495e37
RH-Acked-by: MST <mst@redhat.com>
495e37
RH-Acked-by: Stefano Garzarella <sgarzare@redhat.com>
495e37
495e37
BZ: https://bugzilla.redhat.com/2059786
495e37
BRANCH: rhel-9.0.0
495e37
BREW: https://brewweb.engineering.redhat.com/brew/taskinfo?taskID=43688388
495e37
UPTREAM: Merged
495e37
495e37
If call virtio_queue_set_host_notifier_mr fails, should free
495e37
host-notifier memory-region.
495e37
495e37
This problem can trigger a coredump with some vDPA drivers (mlx5,
495e37
but not with the vdpasim), if we unplug the virtio-net card from
495e37
the guest after a stop/start.
495e37
495e37
The same fix has been done for vhost-user:
495e37
  1f89d3b91e3e ("hw/virtio: Fix leak of host-notifier memory-region")
495e37
495e37
Fixes: d0416d487bd5 ("vhost-vdpa: map virtqueue notification area if possible")
495e37
Cc: jasowang@redhat.com
495e37
Resolves: https://bugzilla.redhat.com/2027208
495e37
Signed-off-by: Laurent Vivier <lvivier@redhat.com>
495e37
Message-Id: <20220211170259.1388734-1-lvivier@redhat.com>
495e37
Cc: qemu-stable@nongnu.org
495e37
Acked-by: Jason Wang <jasowang@redhat.com>
495e37
Reviewed-by: Stefano Garzarella <sgarzare@redhat.com>
495e37
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
495e37
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
495e37
(cherry picked from commit 98f7607ecda00dea3cbb2ed7b4427c96846efb83)
495e37
Signed-off-by: Laurent Vivier <lvivier@redhat.com>
495e37
---
495e37
 hw/virtio/vhost-vdpa.c | 1 +
495e37
 1 file changed, 1 insertion(+)
495e37
495e37
diff --git a/hw/virtio/vhost-vdpa.c b/hw/virtio/vhost-vdpa.c
495e37
index bcaf00e09f..78da48a333 100644
495e37
--- a/hw/virtio/vhost-vdpa.c
495e37
+++ b/hw/virtio/vhost-vdpa.c
495e37
@@ -415,6 +415,7 @@ static int vhost_vdpa_host_notifier_init(struct vhost_dev *dev, int queue_index)
495e37
     g_free(name);
495e37
 
495e37
     if (virtio_queue_set_host_notifier_mr(vdev, queue_index, &n->mr, true)) {
495e37
+        object_unparent(OBJECT(&n->mr));
495e37
         munmap(addr, page_size);
495e37
         goto err;
495e37
     }
495e37
-- 
495e37
2.31.1
495e37