Commit 023e1a8d authored by Hugh Dickins's avatar Hugh Dickins Committed by Linus Torvalds
Browse files

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: cd62734c

 ("mm/rmap: split try_to_munlock from try_to_unmap")
Signed-off-by: default avatarHugh Dickins <>
Reviewed-by: default avatarAlistair Popple <>
Reviewed-by: default avatarShakeel Butt <>
Reported-by: default avatarkernel test robot <>

Cc: Andrew Morton <>
Cc: Jason Gunthorpe <>
Cc: Ralph Campbell <>
Cc: Christoph Hellwig <>
Cc: Yang Shi <>
Cc: Kirill A. Shutemov <>
Signed-off-by: default avatarLinus Torvalds <>
parent d9770fcc
......@@ -1990,14 +1990,13 @@ static bool page_mlock_one(struct page *page, struct vm_area_struct *vma,
* this function is never called when PageDoubleMap().
* No need to scan further once the page is marked
* as mlocked.
return false;
* no need to continue scanning other vma's if the page has
* been locked.
return false;
return true;
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment