Skip to content
Snippets Groups Projects
Commit a7f85e03 authored by Gerd Hoffmann's avatar Gerd Hoffmann
Browse files

virtio-gpu: fix unmap in error path


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: default avatarLaszlo Ersek <lersek@redhat.com>
Signed-off-by: default avatarGerd Hoffmann <kraxel@redhat.com>
Reviewed-by: default avatarLaszlo Ersek <lersek@redhat.com>
Reviewed-by: default avatarLi Qiang <liq3ea@gmail.com>
Message-id: 20190628072357.31782-1-kraxel@redhat.com
parent 506179e4
No related branches found
No related tags found
No related merge requests found
......@@ -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;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment