mm: fix non-anon COW fault

Speculative page fault should skip non-anon COW
faults. But the check uses flags from vmf which is
not initialized at that point. Fix that.

Fixes: eed0466ffa ("mm: skip speculative path for non-anonymous COW faults")
Change-Id: I86c3032680461b1369650d97a06616fd14472632
Signed-off-by: Vinayak Menon <vinmenon@codeaurora.org>
This commit is contained in:
Vinayak Menon 2021-03-16 17:32:45 +05:30
commit 1b7ca44c71

View file

@ -4263,7 +4263,7 @@ int __handle_speculative_fault(struct mm_struct *mm, unsigned long address,
if (unlikely((vma_is_anonymous(vmf.vma) && !vmf.vma->anon_vma) ||
(!vma_is_anonymous(vmf.vma) &&
!(vmf.vma->vm_flags & VM_SHARED) &&
(vmf.flags & FAULT_FLAG_WRITE) &&
(flags & FAULT_FLAG_WRITE) &&
!vmf.vma->anon_vma)))
return VM_FAULT_RETRY;