summaryrefslogtreecommitdiffstats
path: root/samples/vfio-mdev
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 00:27:23 -0600
commit7733e05b34f5d855c5590d816b41ddfee972d188 (patch)
tree392a39c4b933378a88435fd39691a64ead80ca7a /samples/vfio-mdev
parent2203d8a76ea3b962559acfe3bb80eddfdfbc9cee (diff)
downloadlinux-7733e05b34f5d855c5590d816b41ddfee972d188.tar.gz
linux-7733e05b34f5d855c5590d816b41ddfee972d188.tar.bz2
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/vfio-mdev')
-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,
};