summaryrefslogtreecommitdiffstats
path: root/samples
diff options
context:
space:
mode:
authorGerd Hoffmann <kraxel@redhat.com>2018-06-25 08:44:52 +0200
committerAlex Williamson <alex.williamson@redhat.com>2018-06-26 08:27:23 +0200
commit7733e05b34f5d855c5590d816b41ddfee972d188 (patch)
tree392a39c4b933378a88435fd39691a64ead80ca7a /samples
parentsample/mdev/mbochs: remove mbochs_kmap_atomic_dmabuf (diff)
downloadlinux-7733e05b34f5d855c5590d816b41ddfee972d188.tar.xz
linux-7733e05b34f5d855c5590d816b41ddfee972d188.zip
sample/mdev/mbochs: add mbochs_kunmap_dmabuf
There is no default implementation for dma_buf_ops->unmap. So add a function unmapping the page, otherwise we'll leak them. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Diffstat (limited to 'samples')
-rw-r--r--samples/vfio-mdev/mbochs.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/samples/vfio-mdev/mbochs.c b/samples/vfio-mdev/mbochs.c
index aa25cda21d22..85ac6037696f 100644
--- a/samples/vfio-mdev/mbochs.c
+++ b/samples/vfio-mdev/mbochs.c
@@ -811,11 +811,18 @@ static void *mbochs_kmap_dmabuf(struct dma_buf *buf, unsigned long page_num)
return kmap(page);
}
+static void mbochs_kunmap_dmabuf(struct dma_buf *buf, unsigned long page_num,
+ void *vaddr)
+{
+ kunmap(vaddr);
+}
+
static struct dma_buf_ops mbochs_dmabuf_ops = {
.map_dma_buf = mbochs_map_dmabuf,
.unmap_dma_buf = mbochs_unmap_dmabuf,
.release = mbochs_release_dmabuf,
.map = mbochs_kmap_dmabuf,
+ .unmap = mbochs_kunmap_dmabuf,
.mmap = mbochs_mmap_dmabuf,
};