thebeanogamer / rpms / qemu-kvm

Forked from rpms/qemu-kvm 5 months ago
Clone

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

4841a6
From f0115d856f46e65e3b62896f84fe1902a958bf79 Mon Sep 17 00:00:00 2001
4841a6
From: Jon Maloy <jmaloy@redhat.com>
4841a6
Date: Tue, 22 Mar 2022 19:23:36 -0400
4841a6
Subject: [PATCH 04/18] hw/virtio: vdpa: Fix leak of host-notifier
4841a6
 memory-region
4841a6
4841a6
RH-Author: Jon Maloy <jmaloy@redhat.com>
4841a6
RH-MergeRequest: 132: hw/virtio: vdpa: Fix leak of host-notifier memory-region
4841a6
RH-Commit: [1/1] b3cec35d185e3b9844a458f5c51c5d5ef7e3d8f1 (jmaloy/qemu-kvm)
4841a6
RH-Bugzilla: 2060843
60061b
RH-Acked-by: Stefano Garzarella <sgarzare@redhat.com>
4841a6
RH-Acked-by: Laurent Vivier <lvivier@redhat.com>
4841a6
RH-Acked-by: Igor Mammedov <imammedo@redhat.com>
4841a6
4841a6
BZ: https://bugzilla.redhat.com/2060843
4841a6
UPSTREAM: no
4841a6
BREW: https://brewweb.engineering.redhat.com/brew/taskinfo?taskID=44038138
4841a6
4841a6
commit 98f7607ecda00dea3cbb2ed7b4427c96846efb83
4841a6
Author: Laurent Vivier <lvivier@redhat.com>
4841a6
Date:   Fri Feb 11 18:02:59 2022 +0100
4841a6
4841a6
    hw/virtio: vdpa: Fix leak of host-notifier memory-region
4841a6
4841a6
    If call virtio_queue_set_host_notifier_mr fails, should free
4841a6
    host-notifier memory-region.
4841a6
4841a6
    This problem can trigger a coredump with some vDPA drivers (mlx5,
4841a6
    but not with the vdpasim), if we unplug the virtio-net card from
4841a6
    the guest after a stop/start.
4841a6
4841a6
    The same fix has been done for vhost-user:
4841a6
      1f89d3b91e3e ("hw/virtio: Fix leak of host-notifier memory-region")
4841a6
4841a6
    Fixes: d0416d487bd5 ("vhost-vdpa: map virtqueue notification area if possible")
4841a6
    Cc: jasowang@redhat.com
4841a6
    Resolves: https://bugzilla.redhat.com/2027208
4841a6
    Signed-off-by: Laurent Vivier <lvivier@redhat.com>
4841a6
    Message-Id: <20220211170259.1388734-1-lvivier@redhat.com>
4841a6
    Cc: qemu-stable@nongnu.org
4841a6
    Acked-by: Jason Wang <jasowang@redhat.com>
4841a6
    Reviewed-by: Stefano Garzarella <sgarzare@redhat.com>
4841a6
    Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
4841a6
    Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
60061b
60061b
(cherry picked from commit 98f7607ecda00dea3cbb2ed7b4427c96846efb83)
4841a6
Signed-off-by: Jon Maloy <jmaloy@redhat.com>
60061b
---
60061b
 hw/virtio/vhost-vdpa.c | 1 +
60061b
 1 file changed, 1 insertion(+)
60061b
60061b
diff --git a/hw/virtio/vhost-vdpa.c b/hw/virtio/vhost-vdpa.c
60061b
index bcaf00e09f..78da48a333 100644
60061b
--- a/hw/virtio/vhost-vdpa.c
60061b
+++ b/hw/virtio/vhost-vdpa.c
60061b
@@ -415,6 +415,7 @@ static int vhost_vdpa_host_notifier_init(struct vhost_dev *dev, int queue_index)
60061b
     g_free(name);
60061b
 
60061b
     if (virtio_queue_set_host_notifier_mr(vdev, queue_index, &n->mr, true)) {
60061b
+        object_unparent(OBJECT(&n->mr));
60061b
         munmap(addr, page_size);
60061b
         goto err;
60061b
     }
60061b
-- 
60061b
2.27.0
60061b