diff options
author | Thomas Weißschuh <thomas.weissschuh@linutronix.de> | 2024-10-10 09:01:24 +0200 |
---|---|---|
committer | Thomas Gleixner <tglx@linutronix.de> | 2024-11-02 12:37:35 +0100 |
commit | d4526a2d2d01e4dcb09c5535d3d4bb6ca763efeb (patch) | |
tree | 9b9d34db9e4f3c9328c22a13ea86c55f1cf4b78c /arch/powerpc | |
parent | e449c83ac5b1d10cdde084e9d5da1902cde9e823 (diff) |
powerpc/procfs: Propagate error of remap_pfn_range()
If the operation fails and userspace is unaware it will access unmapped
memory, crashing the process.
Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Link: https://lore.kernel.org/all/20241010-vdso-generic-base-v1-22-b64f0842d512@linutronix.de
Diffstat (limited to 'arch/powerpc')
-rw-r--r-- | arch/powerpc/kernel/proc_powerpc.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/arch/powerpc/kernel/proc_powerpc.c b/arch/powerpc/kernel/proc_powerpc.c index b109cd7b5d01..910d2082e05f 100644 --- a/arch/powerpc/kernel/proc_powerpc.c +++ b/arch/powerpc/kernel/proc_powerpc.c @@ -33,10 +33,9 @@ static int page_map_mmap( struct file *file, struct vm_area_struct *vma ) if ((vma->vm_end - vma->vm_start) > PAGE_SIZE) return -EINVAL; - remap_pfn_range(vma, vma->vm_start, - __pa(pde_data(file_inode(file))) >> PAGE_SHIFT, - PAGE_SIZE, vma->vm_page_prot); - return 0; + return remap_pfn_range(vma, vma->vm_start, + __pa(pde_data(file_inode(file))) >> PAGE_SHIFT, + PAGE_SIZE, vma->vm_page_prot); } static const struct proc_ops page_map_proc_ops = { |