The patch titled Subject: collapse_pte_mapped_thp() folio conversion fix has been added to the -mm mm-unstable branch. Its filename is mm-khugepaged-convert-collapse_pte_mapped_thp-to-use-folios-fix.patch This patch will shortly appear at https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/mm-khugepaged-convert-collapse_pte_mapped_thp-to-use-folios-fix.patch This patch will later appear in the mm-unstable branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/process/submit-checklist.rst when testing your code *** The -mm tree is included into linux-next via the mm-everything branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm and is updated there every 2-3 working days ------------------------------------------------------ From: "Vishal Moola (Oracle)" <vishal.moola@xxxxxxxxx> Subject: collapse_pte_mapped_thp() folio conversion fix Date: Wed, 18 Oct 2023 14:24:47 -0700 filemap_lock_folio() can return an ERR_PTR on failure. find_lock_page()/pagecache_get_page() handles this internally, while filemap_lock_folio() does not. Ensure this is checked for in the caller after converting find_lock_page() to filemap_lock_folio(). Link: https://lkml.kernel.org/r/ZTBjv4jyQ5/zu5cw@fedora Signed-off-by: Vishal Moola (Oracle) <vishal.moola@xxxxxxxxx> Reported-by: syzbot+1e2648076cadf48ad9a1@xxxxxxxxxxxxxxxxxxxxxxxxx Closes: https://lkml.kernel.org/r/ZTBjv4jyQ5/zu5cw@fedora Tested-by: syzbot+1e2648076cadf48ad9a1@xxxxxxxxxxxxxxxxxxxxxxxxx Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- mm/khugepaged.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/mm/khugepaged.c~mm-khugepaged-convert-collapse_pte_mapped_thp-to-use-folios-fix +++ a/mm/khugepaged.c @@ -1506,7 +1506,7 @@ int collapse_pte_mapped_thp(struct mm_st folio = filemap_lock_folio(vma->vm_file->f_mapping, linear_page_index(vma, haddr)); - if (!folio) + if (!folio || IS_ERR(folio)) return SCAN_PAGE_NULL; if (folio_order(folio) != HPAGE_PMD_ORDER) { _ Patches currently in -mm which might be from vishal.moola@xxxxxxxxx are mm-khugepaged-convert-__collapse_huge_page_isolate-to-use-folios.patch mm-khugepaged-convert-hpage_collapse_scan_pmd-to-use-folios.patch mm-khugepaged-convert-is_refcount_suitable-to-use-folios.patch mm-khugepaged-convert-alloc_charge_hpage-to-use-folios.patch mm-khugepaged-convert-collapse_pte_mapped_thp-to-use-folios.patch mm-khugepaged-convert-collapse_pte_mapped_thp-to-use-folios-fix.patch