Commit a9e22d29 authored by Jan Kiszka's avatar Jan Kiszka
Browse files

ipipe: Fix get_user_pages usage in __ipipe_pin_vma

Since 9beae1ea

, we are supposed to pass down flags, not just 0 or 1.
Luckily, 1 happened to be FOLL_WRITE, so we did the right thing by
chance.

Moreover, get_user_pages is deprecated in favor of its locked/unlocked/
fast variants.
Signed-off-by: Jan Kiszka's avatarJan Kiszka <jan.kiszka@siemens.com>
parent ed7be01f
...@@ -875,7 +875,8 @@ void user_shm_unlock(size_t size, struct user_struct *user) ...@@ -875,7 +875,8 @@ void user_shm_unlock(size_t size, struct user_struct *user)
#ifdef CONFIG_IPIPE #ifdef CONFIG_IPIPE
int __ipipe_pin_vma(struct mm_struct *mm, struct vm_area_struct *vma) int __ipipe_pin_vma(struct mm_struct *mm, struct vm_area_struct *vma)
{ {
int ret, write, len; unsigned int gup_flags = 0;
int ret, len;
if (vma->vm_flags & (VM_IO | VM_PFNMAP)) if (vma->vm_flags & (VM_IO | VM_PFNMAP))
return 0; return 0;
...@@ -887,9 +888,10 @@ int __ipipe_pin_vma(struct mm_struct *mm, struct vm_area_struct *vma) ...@@ -887,9 +888,10 @@ int __ipipe_pin_vma(struct mm_struct *mm, struct vm_area_struct *vma)
return ret < 0 ? ret : 0; return ret < 0 ? ret : 0;
} }
write = (vma->vm_flags & (VM_WRITE | VM_SHARED)) == VM_WRITE; if ((vma->vm_flags & (VM_WRITE | VM_SHARED)) == VM_WRITE)
gup_flags |= FOLL_WRITE;
len = DIV_ROUND_UP(vma->vm_end, PAGE_SIZE) - vma->vm_start/PAGE_SIZE; len = DIV_ROUND_UP(vma->vm_end, PAGE_SIZE) - vma->vm_start/PAGE_SIZE;
ret = get_user_pages(vma->vm_start, len, write, 0, NULL); ret = get_user_pages_locked(vma->vm_start, len, gup_flags, NULL, NULL);
if (ret < 0) if (ret < 0)
return ret; return ret;
return ret == len ? 0 : -EFAULT; return ret == len ? 0 : -EFAULT;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment