The patch titled Subject: shmem-add-shmem_read_folio-and-shmem_read_folio_gfp-fix has been added to the -mm mm-unstable branch. Its filename is shmem-add-shmem_read_folio-and-shmem_read_folio_gfp-fix.patch This patch will shortly appear at https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/shmem-add-shmem_read_folio-and-shmem_read_folio_gfp-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: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> Subject: shmem-add-shmem_read_folio-and-shmem_read_folio_gfp-fix Date: Wed Feb 8 07:54:45 PM PST 2023 fix shmem_read_mapping_page_gfp(), per Matthew Link: https://lkml.kernel.org/r/Y+QdJTuzxeBYejw2@xxxxxxxxxxxxxxxxxxxx Cc: Charan Teja Kalla <quic_charante@xxxxxxxxxxx> Cc: David Rientjes <rientjes@xxxxxxxxxx> Cc: Hugh Dickins <hughd@xxxxxxxxxx> Cc: Mark Hemment <markhemm@xxxxxxxxxxxxxx> Cc: "Matthew Wilcox (Oracle)" <willy@xxxxxxxxxxxxx> Cc: Michal Hocko <mhocko@xxxxxxxx> Cc: Pavankumar Kondeti <quic_pkondeti@xxxxxxxxxxx> Cc: Shakeel Butt <shakeelb@xxxxxxxxxx> Cc: Suren Baghdasaryan <surenb@xxxxxxxxxx> Cc: Vlastimil Babka <vbabka@xxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- --- a/mm/shmem.c~shmem-add-shmem_read_folio-and-shmem_read_folio_gfp-fix +++ a/mm/shmem.c @@ -4354,8 +4354,12 @@ struct page *shmem_read_mapping_page_gfp pgoff_t index, gfp_t gfp) { struct folio *folio = shmem_read_folio_gfp(mapping, index, gfp); - struct page *page = folio_file_page(folio, index); + struct page *page; + if (IS_ERR(folio)) + return &folio->page; + + page = folio_file_page(folio, index); if (PageHWPoison(page)) { folio_put(folio); return ERR_PTR(-EIO); _ Patches currently in -mm which might be from akpm@xxxxxxxxxxxxxxxxxxxx are mm-shrinkers-fix-deadlock-in-shrinker-debugfs-fix.patch mm-replace-vma-vm_flags-direct-modifications-with-modifier-calls-fix.patch kasan-infer-allocation-size-by-scanning-metadata-fix.patch shmem-add-shmem_read_folio-and-shmem_read_folio_gfp-fix.patch lib-stackdepot-mm-rename-stack_depot_want_early_init-fix.patch lib-stackdepot-annotate-racy-slab_index-accesses-fix.patch