When the mmap function was converted from a file op to a GEM object
function in commit f5ca8eb6f9bd ("drm/cma-helper: Implement mmap as GEM
CMA object functions") some VM flags were not lifted from drm_gem_mmap():

  - VM_IO
  - VM_DONTEXPAND
  - VM_DONTDUMP

VM_DONTEXPAND was added back in commit 59f39bfa6553 ("drm/cma-helper:
Set VM_DONTEXPAND for mmap"). VM_IO doesn't make sense since these are
memory buffers, while "IO tells people not to look at these pages
(accesses can have side effects)".

Add back VM_DONTDUMP. This matches the behavior of most other GEM
implementations.

Signed-off-by: Chen-Yu Tsai <[email protected]>
---
Cc: Thomas Zimmermann <[email protected]>
---
 drivers/gpu/drm/drm_gem_dma_helper.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/drm_gem_dma_helper.c 
b/drivers/gpu/drm/drm_gem_dma_helper.c
index ecb9746f4da8..1911bf6a6a3e 100644
--- a/drivers/gpu/drm/drm_gem_dma_helper.c
+++ b/drivers/gpu/drm/drm_gem_dma_helper.c
@@ -534,7 +534,7 @@ int drm_gem_dma_mmap(struct drm_gem_dma_object *dma_obj, 
struct vm_area_struct *
         * the whole buffer.
         */
        vma->vm_pgoff -= drm_vma_node_start(&obj->vma_node);
-       vm_flags_mod(vma, VM_DONTEXPAND, VM_PFNMAP);
+       vm_flags_mod(vma, VM_DONTDUMP | VM_DONTEXPAND, VM_PFNMAP);
 
        if (dma_obj->map_noncoherent) {
                vma->vm_page_prot = vm_get_page_prot(vma->vm_flags);
-- 
2.53.0.851.ga537e3e6e9-goog

Reply via email to