Skip to content

Commit ebdf832

Browse files
apoppletorvalds
authored andcommitted
mm/migrate: fixup setting UFFD_WP flag
Commit f45ec5f ("userfaultfd: wp: support swap and page migration") introduced support for tracking the uffd wp bit during page migration. However the non-swap PTE variant was used to set the flag for zone device private pages which are a type of swap page. This leads to corruption of the swap offset if the original PTE has the uffd_wp flag set. Fixes: f45ec5f ("userfaultfd: wp: support swap and page migration") Signed-off-by: Alistair Popple <alistair@popple.id.au> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Reviewed-by: Peter Xu <peterx@redhat.com> Cc: Jérôme Glisse <jglisse@redhat.com> Cc: John Hubbard <jhubbard@nvidia.com> Cc: Ralph Campbell <rcampbell@nvidia.com> Link: https://lkml.kernel.org/r/20200825064232.10023-1-alistair@popple.id.au Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent 7867fd7 commit ebdf832

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

mm/migrate.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ static bool remove_migration_pte(struct page *page, struct vm_area_struct *vma,
251251
entry = make_device_private_entry(new, pte_write(pte));
252252
pte = swp_entry_to_pte(entry);
253253
if (pte_swp_uffd_wp(*pvmw.pte))
254-
pte = pte_mkuffd_wp(pte);
254+
pte = pte_swp_mkuffd_wp(pte);
255255
}
256256
}
257257

0 commit comments

Comments
 (0)