diff options
author | Thomas Hellstrom <thellstrom@vmware.com> | 2019-10-04 11:04:43 +0200 |
---|---|---|
committer | Thomas Hellstrom <thellstrom@vmware.com> | 2019-11-06 13:02:25 +0100 |
commit | ace88f1018b88167a78bafd545d30816d6e207bf (patch) | |
tree | 52d80c8bd41e9dd0efea092bd4eeb96915f7536d /mm/pagewalk.c | |
parent | ea81bae46032022656d45d4a395f1bf3b96697f0 (diff) | |
download | talos-op-linux-ace88f1018b88167a78bafd545d30816d6e207bf.tar.gz talos-op-linux-ace88f1018b88167a78bafd545d30816d6e207bf.zip |
mm: pagewalk: Take the pagetable lock in walk_pte_range()
Without the lock, anybody modifying a pte from within this function might
have it concurrently modified by someone else.
Cc: Matthew Wilcox <willy@infradead.org>
Cc: Will Deacon <will.deacon@arm.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Rik van Riel <riel@surriel.com>
Cc: Minchan Kim <minchan@kernel.org>
Cc: Michal Hocko <mhocko@suse.com>
Cc: Huang Ying <ying.huang@intel.com>
Cc: Jérôme Glisse <jglisse@redhat.com>
Cc: Kirill A. Shutemov <kirill@shutemov.name>
Suggested-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Acked-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Diffstat (limited to 'mm/pagewalk.c')
-rw-r--r-- | mm/pagewalk.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/mm/pagewalk.c b/mm/pagewalk.c index d48c2a986ea3..c5fa42cab14f 100644 --- a/mm/pagewalk.c +++ b/mm/pagewalk.c @@ -10,8 +10,9 @@ static int walk_pte_range(pmd_t *pmd, unsigned long addr, unsigned long end, pte_t *pte; int err = 0; const struct mm_walk_ops *ops = walk->ops; + spinlock_t *ptl; - pte = pte_offset_map(pmd, addr); + pte = pte_offset_map_lock(walk->mm, pmd, addr, &ptl); for (;;) { err = ops->pte_entry(pte, addr, addr + PAGE_SIZE, walk); if (err) @@ -22,7 +23,7 @@ static int walk_pte_range(pmd_t *pmd, unsigned long addr, unsigned long end, pte++; } - pte_unmap(pte); + pte_unmap_unlock(pte, ptl); return err; } |