]> git.baikalelectronics.ru Git - kernel.git/commit
mm/hugetlb: avoid corrupting page->mapping in hugetlb_mcopy_atomic_pte
authorMiaohe Lin <linmiaohe@huawei.com>
Tue, 12 Jul 2022 13:05:42 +0000 (21:05 +0800)
committerAndrew Morton <akpm@linux-foundation.org>
Sun, 28 Aug 2022 21:02:43 +0000 (14:02 -0700)
commitfde5888ad27a0b15142ee7028a8a9d2a7c6bc426
tree37814102f0120a2780afde292a65e73c7e9d406d
parenta3240679619e10f0f08fe3c4212755084ceae35a
mm/hugetlb: avoid corrupting page->mapping in hugetlb_mcopy_atomic_pte

In MCOPY_ATOMIC_CONTINUE case with a non-shared VMA, pages in the page
cache are installed in the ptes.  But hugepage_add_new_anon_rmap is called
for them mistakenly because they're not vm_shared.  This will corrupt the
page->mapping used by page cache code.

Link: https://lkml.kernel.org/r/20220712130542.18836-1-linmiaohe@huawei.com
Fixes: 816d55e417af ("userfaultfd: add UFFDIO_CONTINUE ioctl")
Signed-off-by: Miaohe Lin <linmiaohe@huawei.com>
Reviewed-by: Mike Kravetz <mike.kravetz@oracle.com>
Cc: Axel Rasmussen <axelrasmussen@google.com>
Cc: Peter Xu <peterx@redhat.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
mm/hugetlb.c