yeahuh / rpms / qemu-kvm

Forked from rpms/qemu-kvm 2 years ago
Clone
4ec855
From 29e3a6aebf124a88b26fd49a2dd0a99c38f918aa Mon Sep 17 00:00:00 2001
4ec855
From: Gerd Hoffmann <kraxel@redhat.com>
4ec855
Date: Thu, 4 Jul 2019 10:32:07 +0200
4ec855
Subject: [PATCH 4/4] virtio-gpu: fix unmap in error path
4ec855
MIME-Version: 1.0
4ec855
Content-Type: text/plain; charset=UTF-8
4ec855
Content-Transfer-Encoding: 8bit
4ec855
4ec855
RH-Author: Gerd Hoffmann <kraxel@redhat.com>
4ec855
Message-id: <20190704103207.29158-4-kraxel@redhat.com>
4ec855
Patchwork-id: 89373
4ec855
O-Subject: [RHEL-8.1.0 qemu-kvm PATCH v2 3/3] virtio-gpu: fix unmap in error path
4ec855
Bugzilla: 1531543
4ec855
RH-Acked-by: Philippe Mathieu-Daudé <philmd@redhat.com>
4ec855
RH-Acked-by: Laszlo Ersek <lersek@redhat.com>
4ec855
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
4ec855
4ec855
We land here in case not everything we've asked for could be mapped.
4ec855
So unmap only the bytes which have actually been mapped.
4ec855
4ec855
Also we didn't access anything, so acces_len can be 0.
4ec855
4ec855
Reported-by: Laszlo Ersek <lersek@redhat.com>
4ec855
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
4ec855
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
4ec855
Reviewed-by: Li Qiang <liq3ea@gmail.com>
4ec855
Message-id: 20190628072357.31782-1-kraxel@redhat.com
4ec855
(cherry picked from commit a7f85e03b94ffaca75332cddf06426fc85ac611a)
4ec855
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
4ec855
---
4ec855
 hw/display/virtio-gpu.c | 4 ++--
4ec855
 1 file changed, 2 insertions(+), 2 deletions(-)
4ec855
4ec855
diff --git a/hw/display/virtio-gpu.c b/hw/display/virtio-gpu.c
4ec855
index 327c2be..07712d0 100644
4ec855
--- a/hw/display/virtio-gpu.c
4ec855
+++ b/hw/display/virtio-gpu.c
4ec855
@@ -1158,9 +1158,9 @@ static int virtio_gpu_load(QEMUFile *f, void *opaque, size_t size,
4ec855
                 if (res->iov[i].iov_base) {
4ec855
                     dma_memory_unmap(VIRTIO_DEVICE(g)->dma_as,
4ec855
                                      res->iov[i].iov_base,
4ec855
-                                     res->iov[i].iov_len,
4ec855
+                                     len,
4ec855
                                      DMA_DIRECTION_TO_DEVICE,
4ec855
-                                     res->iov[i].iov_len);
4ec855
+                                     0);
4ec855
                 }
4ec855
                 /* ...and the mappings for previous loop iterations */
4ec855
                 res->iov_cnt = i;
4ec855
-- 
4ec855
1.8.3.1
4ec855