Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0f38b9a7 authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "mm: avoid setting up anonymous pages into file mapping"

parents 2b4b89f9 6c36a09c
Loading
Loading
Loading
Loading
+13 −7
Original line number Diff line number Diff line
@@ -2630,6 +2630,10 @@ static int do_anonymous_page(struct mm_struct *mm, struct vm_area_struct *vma,

	pte_unmap(page_table);

	/* File mapping without ->vm_ops ? */
	if (vma->vm_flags & VM_SHARED)
		return VM_FAULT_SIGBUS;

	/* Check if we need to add a guard page to the stack */
	if (check_stack_guard_page(vma, address) < 0)
		return VM_FAULT_SIGSEGV;
@@ -3034,6 +3038,9 @@ static int do_linear_fault(struct mm_struct *mm, struct vm_area_struct *vma,
			- vma->vm_start) >> PAGE_SHIFT) + vma->vm_pgoff;

	pte_unmap(page_table);
	/* The VMA was not fully populated on mmap() or missing VM_DONTEXPAND */
	if (!vma->vm_ops->fault)
		return VM_FAULT_SIGBUS;
	if (!(flags & FAULT_FLAG_WRITE))
		return do_read_fault(mm, vma, address, pmd, pgoff, flags,
				orig_pte);
@@ -3199,13 +3206,12 @@ static int handle_pte_fault(struct mm_struct *mm,
	entry = ACCESS_ONCE(*pte);
	if (!pte_present(entry)) {
		if (pte_none(entry)) {
			if (vma->vm_ops) {
				if (likely(vma->vm_ops->fault))
					return do_linear_fault(mm, vma, address,
						pte, pmd, flags, entry);
			}
			return do_anonymous_page(mm, vma, address,
						 pte, pmd, flags);
			if (vma->vm_ops)
				return do_linear_fault(mm, vma, address, pte,
					pmd, flags, entry);

			return do_anonymous_page(mm, vma, address, pte, pmd,
					flags);
		}
		if (pte_file(entry))
			return do_nonlinear_fault(mm, vma, address,