Skip to content

Commit d4526a2

Browse files
t-8chKAGA-KOKO
authored andcommitted
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 <[email protected]> Signed-off-by: Thomas Gleixner <[email protected]> Link: https://lore.kernel.org/all/[email protected]
1 parent e449c83 commit d4526a2

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

arch/powerpc/kernel/proc_powerpc.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,9 @@ static int page_map_mmap( struct file *file, struct vm_area_struct *vma )
3333
if ((vma->vm_end - vma->vm_start) > PAGE_SIZE)
3434
return -EINVAL;
3535

36-
remap_pfn_range(vma, vma->vm_start,
37-
__pa(pde_data(file_inode(file))) >> PAGE_SHIFT,
38-
PAGE_SIZE, vma->vm_page_prot);
39-
return 0;
36+
return remap_pfn_range(vma, vma->vm_start,
37+
__pa(pde_data(file_inode(file))) >> PAGE_SHIFT,
38+
PAGE_SIZE, vma->vm_page_prot);
4039
}
4140

4241
static const struct proc_ops page_map_proc_ops = {

0 commit comments

Comments
 (0)