Skip to content

Commit

Permalink
virtio-gpu: fix unmap in error path
Browse files Browse the repository at this point in the history
We land here in case not everything we've asked for could be mapped.
So unmap only the bytes which have actually been mapped.

Also we didn't access anything, so acces_len can be 0.

Reported-by: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Li Qiang <liq3ea@gmail.com>
Message-id: 20190628072357.31782-1-kraxel@redhat.com
  • Loading branch information
kraxel committed Jul 3, 2019
1 parent 506179e commit a7f85e0
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions hw/display/virtio-gpu.c
Expand Up @@ -1048,9 +1048,9 @@ static int virtio_gpu_load(QEMUFile *f, void *opaque, size_t size,
if (res->iov[i].iov_base) {
dma_memory_unmap(VIRTIO_DEVICE(g)->dma_as,
res->iov[i].iov_base,
res->iov[i].iov_len,
len,
DMA_DIRECTION_TO_DEVICE,
res->iov[i].iov_len);
0);
}
/* ...and the mappings for previous loop iterations */
res->iov_cnt = i;
Expand Down

0 comments on commit a7f85e0

Please sign in to comment.