]> git.baikalelectronics.ru Git - kernel.git/commit
mm/rmap: fix new bug: premature return from page_mlock_one()
authorHugh Dickins <hughd@google.com>
Wed, 7 Jul 2021 20:11:24 +0000 (13:11 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Sun, 11 Jul 2021 22:05:15 +0000 (15:05 -0700)
commitc51cd8b6faaf462ded8d8e9b339c1bd1c22d092d
treea460bbc7478c15f8cea3366785ad91607d0529fc
parentd8d57d4013afdceccac3c0bae964a28c732be39b
mm/rmap: fix new bug: premature return from page_mlock_one()

In the unlikely race case that page_mlock_one() finds VM_LOCKED has been
cleared by the time it got page table lock, page_vma_mapped_walk_done()
must be called before returning, either explicitly, or by a final call
to page_vma_mapped_walk() - otherwise the page table remains locked.

Fixes: d0deaf584653 ("mm/rmap: split try_to_munlock from try_to_unmap")
Signed-off-by: Hugh Dickins <hughd@google.com>
Reviewed-by: Alistair Popple <apopple@nvidia.com>
Reviewed-by: Shakeel Butt <shakeelb@google.com>
Reported-by: kernel test robot <oliver.sang@intel.com>
Link: https://lore.kernel.org/lkml/20210711151446.GB4070@xsang-OptiPlex-9020/
Link: https://lore.kernel.org/lkml/f71f8523-cba7-3342-40a7-114abc5d1f51@google.com/
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Jason Gunthorpe <jgg@nvidia.com>
Cc: Ralph Campbell <rcampbell@nvidia.com>
Cc: Christoph Hellwig <hch@lst.de>
Cc: Yang Shi <shy828301@gmail.com>
Cc: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
mm/rmap.c