summaryrefslogtreecommitdiffstats
path: root/mm/memory.c
diff options
context:
space:
mode:
authorAndrew Morton <akpm@linux-foundation.org>2022-09-26 22:13:15 +0200
committerAndrew Morton <akpm@linux-foundation.org>2022-09-26 22:13:15 +0200
commit6d751329e761338faa9c24c2c9736f27bc54282b (patch)
tree6e1778a7448552c58d12da88f70f6ad2718d55da /mm/memory.c
parentmm: fix PageAnonExclusive clearing racing with concurrent RCU GUP-fast (diff)
parentx86/uaccess: avoid check_object_size() in copy_from_user_nmi() (diff)
downloadlinux-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.c14
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;
}