]> Git Repo - linux.git/commit
mm: mempolicy: fix potential pte_unmap_unlock pte error
authorShijie Luo <[email protected]>
Mon, 2 Nov 2020 01:07:40 +0000 (17:07 -0800)
committerLinus Torvalds <[email protected]>
Mon, 2 Nov 2020 20:14:19 +0000 (12:14 -0800)
commit3f08842098e842c51e3b97d0dcdebf810b32558e
treea1b568a08112ffb7898d89e8bbf3d7fc36715bfd
parent58b999d7a22c59313e1e84832607c7a61640f4e7
mm: mempolicy: fix potential pte_unmap_unlock pte error

When flags in queue_pages_pte_range don't have MPOL_MF_MOVE or
MPOL_MF_MOVE_ALL bits, code breaks and passing origin pte - 1 to
pte_unmap_unlock seems like not a good idea.

queue_pages_pte_range can run in MPOL_MF_MOVE_ALL mode which doesn't
migrate misplaced pages but returns with EIO when encountering such a
page.  Since commit a7f40cfe3b7a ("mm: mempolicy: make mbind() return
-EIO when MPOL_MF_STRICT is specified") and early break on the first pte
in the range results in pte_unmap_unlock on an underflow pte.  This can
lead to lockups later on when somebody tries to lock the pte resp.
page_table_lock again..

Fixes: a7f40cfe3b7a ("mm: mempolicy: make mbind() return -EIO when MPOL_MF_STRICT is specified")
Signed-off-by: Shijie Luo <[email protected]>
Signed-off-by: Miaohe Lin <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Reviewed-by: Oscar Salvador <[email protected]>
Acked-by: Michal Hocko <[email protected]>
Cc: Miaohe Lin <[email protected]>
Cc: Feilong Lin <[email protected]>
Cc: Shijie Luo <[email protected]>
Cc: <[email protected]>
Link: https://lkml.kernel.org/r/[email protected]
Signed-off-by: Linus Torvalds <[email protected]>
mm/mempolicy.c
This page took 0.0592 seconds and 4 git commands to generate.