__wp_page_copy_user() sometimes needs to read a page directly via a user mapping; to perform the uaccess we therefore need to create a valid user pointer from the address of the page.
uaddr_to_user_ptr_safe() should no longer be used for that purpose. Instead, we use make_user_ptr_for_read_uaccess() to create a user pointer with appropriate bounds and permissions (in PCuABI).
Signed-off-by: Kevin Brodsky kevin.brodsky@arm.com --- mm/memory.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/mm/memory.c b/mm/memory.c index 3e4490f4ab6e..e3cc37514a33 100644 --- a/mm/memory.c +++ b/mm/memory.c @@ -2852,7 +2852,7 @@ static inline bool __wp_page_copy_user(struct page *dst, struct page *src, { bool ret; void *kaddr; - void __user *uaddr; + const void __user *uaddr; bool locked = false; struct vm_area_struct *vma = vmf->vma; struct mm_struct *mm = vma->vm_mm; @@ -2870,7 +2870,7 @@ static inline bool __wp_page_copy_user(struct page *dst, struct page *src, * fails, we just zero-fill it. Live with it. */ kaddr = kmap_atomic(dst); - uaddr = uaddr_to_user_ptr_safe(addr & PAGE_MASK); + uaddr = make_user_ptr_for_read_uaccess(addr & PAGE_MASK, PAGE_SIZE);
/* * On architectures with software "accessed" bits, we would