The patch titled Subject: secretmem/gup: don't check if page is secretmem without reference has been removed from the -mm tree. Its filename was mm-introduce-memfd_secret-system-call-to-create-secret-memory-areas-fix-2.patch This patch was dropped because an updated version will be merged ------------------------------------------------------ From: Mike Rapoport <rppt@xxxxxxxxxxxxx> Subject: secretmem/gup: don't check if page is secretmem without reference The check in gup_pte_range() whether a page belongs to a secretmem mapping is performed before grabbing the page reference. To avoid potential race move the check after try_grab_compound_head(). Link: https://lkml.kernel.org/r/20210420150049.14031-2-rppt@xxxxxxxxxx Signed-off-by: Mike Rapoport <rppt@xxxxxxxxxxxxx> Reviewed-by: David Hildenbrand <david@xxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- mm/gup.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) --- a/mm/gup.c~mm-introduce-memfd_secret-system-call-to-create-secret-memory-areas-fix-2 +++ a/mm/gup.c @@ -2145,13 +2145,15 @@ static int gup_pte_range(pmd_t pmd, unsi VM_BUG_ON(!pfn_valid(pte_pfn(pte))); page = pte_page(pte); - if (page_is_secretmem(page)) - goto pte_unmap; - head = try_grab_compound_head(page, 1, flags); if (!head) goto pte_unmap; + if (unlikely(page_is_secretmem(page))) { + put_compound_head(head, 1, flags); + goto pte_unmap; + } + if (unlikely(pte_val(pte) != pte_val(*ptep))) { put_compound_head(head, 1, flags); goto pte_unmap; _ Patches currently in -mm which might be from rppt@xxxxxxxxxxxxx are mm-mmzoneh-simplify-is_highmem_idx.patch docs-procrst-meminfo-briefly-describe-gaps-in-memory-accounting.patch include-linux-mmzoneh-add-documentation-for-pfn_valid.patch memblock-update-initialization-of-reserved-pages.patch arm64-decouple-check-whether-pfn-is-in-linear-map-from-pfn_valid.patch arm64-drop-pfn_valid_within-and-simplify-pfn_valid.patch mmap-make-mlock_future_check-global.patch riscv-kconfig-make-direct-map-manipulation-options-depend-on-mmu.patch set_memory-allow-set_direct_map__noflush-for-multiple-pages.patch set_memory-allow-querying-whether-set_direct_map_-is-actually-enabled.patch mm-introduce-memfd_secret-system-call-to-create-secret-memory-areas.patch pm-hibernate-disable-when-there-are-active-secretmem-users.patch arch-mm-wire-up-memfd_secret-system-call-where-relevant.patch secretmem-test-add-basic-selftest-for-memfd_secret2.patch mm-introduce-memfd_secret-system-call-to-create-secret-memory-areas-fix-3.patch arch-mm-wire-up-memfd_secret-system-call-where-relevant-fix.patch