diff options
| author | Thomas Zimmermann <[email protected]> | 2021-01-15 09:30:38 +0000 |
|---|---|---|
| committer | Thomas Zimmermann <[email protected]> | 2021-01-18 09:37:26 +0000 |
| commit | 47d35c1c40d53411d77d214644e12734901c553c (patch) | |
| tree | 6b50742985e3bb4b2723c8f1e14d0d14e81fda38 /drivers/gpu/drm/drm_prime.c | |
| parent | drm/vkms: Fix missing kmalloc allocation failure check (diff) | |
| download | kernel-47d35c1c40d53411d77d214644e12734901c553c.tar.gz kernel-47d35c1c40d53411d77d214644e12734901c553c.zip | |
drm: Set vm_ops to GEM object's values during mmap
The GEM mmap code relies on the GEM object's mmap callback to set the
VMA's vm_ops field. This is easily forgotten and already led to a memory
leak in the CMA helpers. Instead set the vm_ops field in the DRM core
code to the GEM object's value. Drivers with different needs can override
this in their mmap callback.
v2:
* support (vm_ops == NULL) if mmap is given; required by VRAM
helpers
Signed-off-by: Thomas Zimmermann <[email protected]>
Fixes: f5ca8eb6f9bd ("drm/cma-helper: Implement mmap as GEM CMA object functions")
Reviewed-by: Daniel Vetter <[email protected]>
Reported-by: Kieran Bingham <[email protected]>
Tested-by: Kieran Bingham <[email protected]>
Cc: Maxime Ripard <[email protected]>
Cc: Maarten Lankhorst <[email protected]>
Cc: David Airlie <[email protected]>
Cc: Daniel Vetter <[email protected]>
Cc: Eric Anholt <[email protected]>
Cc: [email protected]
Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
Diffstat (limited to 'drivers/gpu/drm/drm_prime.c')
| -rw-r--r-- | drivers/gpu/drm/drm_prime.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/gpu/drm/drm_prime.c b/drivers/gpu/drm/drm_prime.c index 683aa29ecd3b..2a54f86856af 100644 --- a/drivers/gpu/drm/drm_prime.c +++ b/drivers/gpu/drm/drm_prime.c @@ -717,6 +717,8 @@ int drm_gem_prime_mmap(struct drm_gem_object *obj, struct vm_area_struct *vma) vma->vm_pgoff += drm_vma_node_start(&obj->vma_node); if (obj->funcs && obj->funcs->mmap) { + vma->vm_ops = obj->funcs->vm_ops; + ret = obj->funcs->mmap(obj, vma); if (ret) return ret; |
