Skip to content

Commit faad9bf

Browse files
David Hildenbrandpopcornmix
authored andcommitted
s390/pci_mmio: fully validate the VMA before calling follow_pte()
commit a8b92b8 upstream. We should not walk/touch page tables outside of VMA boundaries when holding only the mmap sem in read mode. Evil user space can modify the VMA layout just before this function runs and e.g., trigger races with page table removal code since commit dd2283f ("mm: mmap: zap pages with read mmap_sem in munmap"). find_vma() does not check if the address is >= the VMA start address; use vma_lookup() instead. Reviewed-by: Niklas Schnelle <schnelle@linux.ibm.com> Reviewed-by: Liam R. Howlett <Liam.Howlett@oracle.com> Fixes: dd2283f ("mm: mmap: zap pages with read mmap_sem in munmap") Signed-off-by: David Hildenbrand <david@redhat.com> Signed-off-by: Vasily Gorbik <gor@linux.ibm.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent e642783 commit faad9bf

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

‎arch/s390/pci/pci_mmio.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ static long get_pfn(unsigned long user_addr, unsigned long access,
128128
mmap_read_lock(current->mm);
129129
ret = -EINVAL;
130130
vma = find_vma(current->mm, user_addr);
131-
if (!vma)
131+
if (!vma || user_addr < vma->vm_start)
132132
goto out;
133133
ret = -EACCES;
134134
if (!(vma->vm_flags & access))

0 commit comments

Comments
 (0)