thebeanogamer / rpms / qemu-kvm

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