Skip to content

Commit ab74ef7

Browse files
MiaoheLinakpm00
authored andcommitted
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/[email protected] Fixes: f619147 ("userfaultfd: add UFFDIO_CONTINUE ioctl") Signed-off-by: Miaohe Lin <[email protected]> Reviewed-by: Mike Kravetz <[email protected]> Cc: Axel Rasmussen <[email protected]> Cc: Peter Xu <[email protected]> Cc: <[email protected]> Signed-off-by: Andrew Morton <[email protected]>
1 parent ec66244 commit ab74ef7

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

mm/hugetlb.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6041,7 +6041,7 @@ int hugetlb_mcopy_atomic_pte(struct mm_struct *dst_mm,
60416041
if (!huge_pte_none_mostly(huge_ptep_get(dst_pte)))
60426042
goto out_release_unlock;
60436043

6044-
if (vm_shared) {
6044+
if (page_in_pagecache) {
60456045
page_dup_file_rmap(page, true);
60466046
} else {
60476047
ClearHPageRestoreReserve(page);

0 commit comments

Comments
 (0)