Commit c9088328 authored by Jan Kiszka's avatar Jan Kiszka

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 a4d1c1e1
......@@ -868,7 +868,8 @@ void user_shm_unlock(size_t size, struct user_struct *user)
#ifdef CONFIG_IPIPE
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))
return 0;
......@@ -880,9 +881,10 @@ int __ipipe_pin_vma(struct mm_struct *mm, struct vm_area_struct *vma)
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;
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)
return ret;
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