|
![](https://seccdn.libravatar.org/avatar/e0cb5334e5a1824445e4ed5d9488fcffc5d667adb8665f37581b8d299b22ec59?s=16&d=retro) |
4d7edd7 |
From: Li Qiang <liq3ea@gmail.com>
|
|
![](https://seccdn.libravatar.org/avatar/e0cb5334e5a1824445e4ed5d9488fcffc5d667adb8665f37581b8d299b22ec59?s=16&d=retro) |
4d7edd7 |
Date: Mon, 28 Nov 2016 21:29:25 -0500
|
|
![](https://seccdn.libravatar.org/avatar/e0cb5334e5a1824445e4ed5d9488fcffc5d667adb8665f37581b8d299b22ec59?s=16&d=retro) |
4d7edd7 |
Subject: [PATCH] virtio-gpu: call cleanup mapping function in resource destroy
|
|
![](https://seccdn.libravatar.org/avatar/e0cb5334e5a1824445e4ed5d9488fcffc5d667adb8665f37581b8d299b22ec59?s=16&d=retro) |
4d7edd7 |
MIME-Version: 1.0
|
|
![](https://seccdn.libravatar.org/avatar/e0cb5334e5a1824445e4ed5d9488fcffc5d667adb8665f37581b8d299b22ec59?s=16&d=retro) |
4d7edd7 |
Content-Type: text/plain; charset=UTF-8
|
|
![](https://seccdn.libravatar.org/avatar/e0cb5334e5a1824445e4ed5d9488fcffc5d667adb8665f37581b8d299b22ec59?s=16&d=retro) |
4d7edd7 |
Content-Transfer-Encoding: 8bit
|
|
![](https://seccdn.libravatar.org/avatar/e0cb5334e5a1824445e4ed5d9488fcffc5d667adb8665f37581b8d299b22ec59?s=16&d=retro) |
4d7edd7 |
|
|
![](https://seccdn.libravatar.org/avatar/e0cb5334e5a1824445e4ed5d9488fcffc5d667adb8665f37581b8d299b22ec59?s=16&d=retro) |
4d7edd7 |
If the guest destroy the resource before detach banking, the 'iov'
|
|
![](https://seccdn.libravatar.org/avatar/e0cb5334e5a1824445e4ed5d9488fcffc5d667adb8665f37581b8d299b22ec59?s=16&d=retro) |
4d7edd7 |
and 'addrs' field in resource is not freed thus leading memory
|
|
![](https://seccdn.libravatar.org/avatar/e0cb5334e5a1824445e4ed5d9488fcffc5d667adb8665f37581b8d299b22ec59?s=16&d=retro) |
4d7edd7 |
leak issue. This patch avoid this.
|
|
![](https://seccdn.libravatar.org/avatar/e0cb5334e5a1824445e4ed5d9488fcffc5d667adb8665f37581b8d299b22ec59?s=16&d=retro) |
4d7edd7 |
|
|
![](https://seccdn.libravatar.org/avatar/e0cb5334e5a1824445e4ed5d9488fcffc5d667adb8665f37581b8d299b22ec59?s=16&d=retro) |
4d7edd7 |
Signed-off-by: Li Qiang <liq3ea@gmail.com>
|
|
![](https://seccdn.libravatar.org/avatar/e0cb5334e5a1824445e4ed5d9488fcffc5d667adb8665f37581b8d299b22ec59?s=16&d=retro) |
4d7edd7 |
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
|
|
![](https://seccdn.libravatar.org/avatar/e0cb5334e5a1824445e4ed5d9488fcffc5d667adb8665f37581b8d299b22ec59?s=16&d=retro) |
4d7edd7 |
Message-id: 1480386565-10077-1-git-send-email-liq3ea@gmail.com
|
|
![](https://seccdn.libravatar.org/avatar/e0cb5334e5a1824445e4ed5d9488fcffc5d667adb8665f37581b8d299b22ec59?s=16&d=retro) |
4d7edd7 |
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
|
|
![](https://seccdn.libravatar.org/avatar/e0cb5334e5a1824445e4ed5d9488fcffc5d667adb8665f37581b8d299b22ec59?s=16&d=retro) |
4d7edd7 |
(cherry picked from commit b8e23926c568f2e963af39028b71c472e3023793)
|
|
![](https://seccdn.libravatar.org/avatar/e0cb5334e5a1824445e4ed5d9488fcffc5d667adb8665f37581b8d299b22ec59?s=16&d=retro) |
4d7edd7 |
---
|
|
![](https://seccdn.libravatar.org/avatar/e0cb5334e5a1824445e4ed5d9488fcffc5d667adb8665f37581b8d299b22ec59?s=16&d=retro) |
4d7edd7 |
hw/display/virtio-gpu.c | 3 +++
|
|
![](https://seccdn.libravatar.org/avatar/e0cb5334e5a1824445e4ed5d9488fcffc5d667adb8665f37581b8d299b22ec59?s=16&d=retro) |
4d7edd7 |
1 file changed, 3 insertions(+)
|
|
![](https://seccdn.libravatar.org/avatar/e0cb5334e5a1824445e4ed5d9488fcffc5d667adb8665f37581b8d299b22ec59?s=16&d=retro) |
4d7edd7 |
|
|
![](https://seccdn.libravatar.org/avatar/e0cb5334e5a1824445e4ed5d9488fcffc5d667adb8665f37581b8d299b22ec59?s=16&d=retro) |
4d7edd7 |
diff --git a/hw/display/virtio-gpu.c b/hw/display/virtio-gpu.c
|
|
![](https://seccdn.libravatar.org/avatar/e0cb5334e5a1824445e4ed5d9488fcffc5d667adb8665f37581b8d299b22ec59?s=16&d=retro) |
4d7edd7 |
index f41afc7..4ccc8bc 100644
|
|
![](https://seccdn.libravatar.org/avatar/e0cb5334e5a1824445e4ed5d9488fcffc5d667adb8665f37581b8d299b22ec59?s=16&d=retro) |
4d7edd7 |
--- a/hw/display/virtio-gpu.c
|
|
![](https://seccdn.libravatar.org/avatar/e0cb5334e5a1824445e4ed5d9488fcffc5d667adb8665f37581b8d299b22ec59?s=16&d=retro) |
4d7edd7 |
+++ b/hw/display/virtio-gpu.c
|
|
![](https://seccdn.libravatar.org/avatar/e0cb5334e5a1824445e4ed5d9488fcffc5d667adb8665f37581b8d299b22ec59?s=16&d=retro) |
4d7edd7 |
@@ -23,6 +23,8 @@
|
|
![](https://seccdn.libravatar.org/avatar/e0cb5334e5a1824445e4ed5d9488fcffc5d667adb8665f37581b8d299b22ec59?s=16&d=retro) |
4d7edd7 |
static struct virtio_gpu_simple_resource*
|
|
![](https://seccdn.libravatar.org/avatar/e0cb5334e5a1824445e4ed5d9488fcffc5d667adb8665f37581b8d299b22ec59?s=16&d=retro) |
4d7edd7 |
virtio_gpu_find_resource(VirtIOGPU *g, uint32_t resource_id);
|
|
![](https://seccdn.libravatar.org/avatar/e0cb5334e5a1824445e4ed5d9488fcffc5d667adb8665f37581b8d299b22ec59?s=16&d=retro) |
4d7edd7 |
|
|
![](https://seccdn.libravatar.org/avatar/e0cb5334e5a1824445e4ed5d9488fcffc5d667adb8665f37581b8d299b22ec59?s=16&d=retro) |
4d7edd7 |
+static void virtio_gpu_cleanup_mapping(struct virtio_gpu_simple_resource *res);
|
|
![](https://seccdn.libravatar.org/avatar/e0cb5334e5a1824445e4ed5d9488fcffc5d667adb8665f37581b8d299b22ec59?s=16&d=retro) |
4d7edd7 |
+
|
|
![](https://seccdn.libravatar.org/avatar/e0cb5334e5a1824445e4ed5d9488fcffc5d667adb8665f37581b8d299b22ec59?s=16&d=retro) |
4d7edd7 |
#ifdef CONFIG_VIRGL
|
|
![](https://seccdn.libravatar.org/avatar/e0cb5334e5a1824445e4ed5d9488fcffc5d667adb8665f37581b8d299b22ec59?s=16&d=retro) |
4d7edd7 |
#include "virglrenderer.h"
|
|
![](https://seccdn.libravatar.org/avatar/e0cb5334e5a1824445e4ed5d9488fcffc5d667adb8665f37581b8d299b22ec59?s=16&d=retro) |
4d7edd7 |
#define VIRGL(_g, _virgl, _simple, ...) \
|
|
![](https://seccdn.libravatar.org/avatar/e0cb5334e5a1824445e4ed5d9488fcffc5d667adb8665f37581b8d299b22ec59?s=16&d=retro) |
4d7edd7 |
@@ -349,6 +351,7 @@ static void virtio_gpu_resource_destroy(VirtIOGPU *g,
|
|
![](https://seccdn.libravatar.org/avatar/e0cb5334e5a1824445e4ed5d9488fcffc5d667adb8665f37581b8d299b22ec59?s=16&d=retro) |
4d7edd7 |
struct virtio_gpu_simple_resource *res)
|
|
![](https://seccdn.libravatar.org/avatar/e0cb5334e5a1824445e4ed5d9488fcffc5d667adb8665f37581b8d299b22ec59?s=16&d=retro) |
4d7edd7 |
{
|
|
![](https://seccdn.libravatar.org/avatar/e0cb5334e5a1824445e4ed5d9488fcffc5d667adb8665f37581b8d299b22ec59?s=16&d=retro) |
4d7edd7 |
pixman_image_unref(res->image);
|
|
![](https://seccdn.libravatar.org/avatar/e0cb5334e5a1824445e4ed5d9488fcffc5d667adb8665f37581b8d299b22ec59?s=16&d=retro) |
4d7edd7 |
+ virtio_gpu_cleanup_mapping(res);
|
|
![](https://seccdn.libravatar.org/avatar/e0cb5334e5a1824445e4ed5d9488fcffc5d667adb8665f37581b8d299b22ec59?s=16&d=retro) |
4d7edd7 |
QTAILQ_REMOVE(&g->reslist, res, next);
|
|
![](https://seccdn.libravatar.org/avatar/e0cb5334e5a1824445e4ed5d9488fcffc5d667adb8665f37581b8d299b22ec59?s=16&d=retro) |
4d7edd7 |
g_free(res);
|
|
![](https://seccdn.libravatar.org/avatar/e0cb5334e5a1824445e4ed5d9488fcffc5d667adb8665f37581b8d299b22ec59?s=16&d=retro) |
4d7edd7 |
}
|