]> git.baikalelectronics.ru Git - kernel.git/commit
hugetlbfs: flush before unlock on move_hugetlb_page_tables()
authorNadav Amit <namit@vmware.com>
Sun, 21 Nov 2021 20:40:08 +0000 (12:40 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Mon, 22 Nov 2021 19:36:46 +0000 (11:36 -0800)
commitd72873cb710c01efbafd6926e2bf5443ffc9f7b5
treef299abe211d8fdb36b2134fc739fbb5880cebacb
parente6ee2b1b237636667e99f1f26c90a68f88a9fdc5
hugetlbfs: flush before unlock on move_hugetlb_page_tables()

We must flush the TLB before releasing i_mmap_rwsem to avoid the
potential reuse of an unshared PMDs page.  This is not true in the case
of move_hugetlb_page_tables().  The last reference on the page table can
therefore be dropped before the TLB flush took place.

Prevent it by reordering the operations and flushing the TLB before
releasing i_mmap_rwsem.

Fixes: b5baa59aa48d ("mm, hugepages: add mremap() support for hugepage backed vma")
Signed-off-by: Nadav Amit <namit@vmware.com>
Reviewed-by: Mike Kravetz <mike.kravetz@oracle.com>
Cc: Mina Almasry <almasrymina@google.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
mm/hugetlb.c