diff options
author | Andrew Morton <akpm@linux-foundation.org> | 2022-09-26 22:13:15 +0200 |
---|---|---|
committer | Andrew Morton <akpm@linux-foundation.org> | 2022-09-26 22:13:15 +0200 |
commit | 6d751329e761338faa9c24c2c9736f27bc54282b (patch) | |
tree | 6e1778a7448552c58d12da88f70f6ad2718d55da /mm/memory.c | |
parent | mm: fix PageAnonExclusive clearing racing with concurrent RCU GUP-fast (diff) | |
parent | x86/uaccess: avoid check_object_size() in copy_from_user_nmi() (diff) | |
download | linux-6d751329e761338faa9c24c2c9736f27bc54282b.tar.xz linux-6d751329e761338faa9c24c2c9736f27bc54282b.zip |
Merge branch 'mm-hotfixes-stable' into mm-stable
Diffstat (limited to 'mm/memory.c')
-rw-r--r-- | mm/memory.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/mm/memory.c b/mm/memory.c index b994784158f5..e38f9245470c 100644 --- a/mm/memory.c +++ b/mm/memory.c @@ -4387,14 +4387,20 @@ vm_fault_t finish_fault(struct vm_fault *vmf) vmf->pte = pte_offset_map_lock(vma->vm_mm, vmf->pmd, vmf->address, &vmf->ptl); - ret = 0; + /* Re-check under ptl */ - if (likely(!vmf_pte_changed(vmf))) + if (likely(!vmf_pte_changed(vmf))) { do_set_pte(vmf, page, vmf->address); - else + + /* no need to invalidate: a not-present page won't be cached */ + update_mmu_cache(vma, vmf->address, vmf->pte); + + ret = 0; + } else { + update_mmu_tlb(vma, vmf->address, vmf->pte); ret = VM_FAULT_NOPAGE; + } - update_mmu_tlb(vma, vmf->address, vmf->pte); pte_unmap_unlock(vmf->pte, vmf->ptl); return ret; } |