diff options
author | Lucas Stach <l.stach@pengutronix.de> | 2016-04-27 12:27:02 +0200 |
---|---|---|
committer | Lucas Stach <l.stach@pengutronix.de> | 2016-05-06 10:42:33 +0200 |
commit | a10e2bde5d9173570d97a4d7cdf038232baaf47e (patch) | |
tree | a02474c1e2d5c4b275732ba390ba2115d7fd44b1 /drivers/gpu/drm/etnaviv/etnaviv_gem_prime.c | |
parent | 0e7f26e6b950fe586c8aa6ff6f87b9936ae32ebb (diff) | |
download | op-kernel-dev-a10e2bde5d9173570d97a4d7cdf038232baaf47e.zip op-kernel-dev-a10e2bde5d9173570d97a4d7cdf038232baaf47e.tar.gz |
drm/etnaviv: fix mmap operations for userptr and dma-buf objects
Add an indirect object operations call to allow distinct implementations
of the mmap operation based on the type of the object.
This ensures that the exporter is called to set up the mmap for imported
dma-bufs and disallows mapping of userptr objects through the DRM file,
as this might lead to serious corruption of kernel internal state.
Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Diffstat (limited to 'drivers/gpu/drm/etnaviv/etnaviv_gem_prime.c')
-rw-r--r-- | drivers/gpu/drm/etnaviv/etnaviv_gem_prime.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/drivers/gpu/drm/etnaviv/etnaviv_gem_prime.c b/drivers/gpu/drm/etnaviv/etnaviv_gem_prime.c index 4e67395..b93618c 100644 --- a/drivers/gpu/drm/etnaviv/etnaviv_gem_prime.c +++ b/drivers/gpu/drm/etnaviv/etnaviv_gem_prime.c @@ -84,10 +84,17 @@ static void *etnaviv_gem_prime_vmap_impl(struct etnaviv_gem_object *etnaviv_obj) return dma_buf_vmap(etnaviv_obj->base.import_attach->dmabuf); } +static int etnaviv_gem_prime_mmap_obj(struct etnaviv_gem_object *etnaviv_obj, + struct vm_area_struct *vma) +{ + return dma_buf_mmap(etnaviv_obj->base.dma_buf, vma, 0); +} + static const struct etnaviv_gem_ops etnaviv_gem_prime_ops = { /* .get_pages should never be called */ .release = etnaviv_gem_prime_release, .vmap = etnaviv_gem_prime_vmap_impl, + .mmap = etnaviv_gem_prime_mmap_obj, }; struct drm_gem_object *etnaviv_gem_prime_import_sg_table(struct drm_device *dev, |