From: Ma Wupeng mawupeng1@huawei.com
euleros inclusion category: bugfix bugzilla: https://gitee.com/openeuler/kernel/issues/I7WLVX
---------------------------------------------
During mmap_region, vm_flags is not save in gmf which lead to prot in gmf is always VM_NONE.
To fix this, update prot to gmf during init.
Fixes: 848492f233ce ("mm: gmem: Introduce vm_object for gmem") Signed-off-by: Ma Wupeng mawupeng1@huawei.com --- mm/mmap.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/mm/mmap.c b/mm/mmap.c index 061cc7381233..a28b17c3cc83 100644 --- a/mm/mmap.c +++ b/mm/mmap.c @@ -2732,20 +2732,18 @@ static int alloc_va_in_peer_devices(struct mm_struct *mm, vm_flags_t vm_flags) { gm_context_t *ctx, *tmp; - gm_prot_t prot = VM_NONE; gm_ret_t ret; struct gm_fault_t gmf = { .mm = mm, .va = addr, .size = len, - .prot = prot, + .prot = vm_flags, };
pr_debug("gmem: start mmap, as %p\n", mm->gm_as); if (!mm->gm_as) return -ENODEV;
- prot |= vm_flags; if (!vma->vm_obj) vma->vm_obj = vm_object_create(vma); if (!vma->vm_obj)