The patch titled Subject: RE: [fs?] [mm?] INFO: task hung in remove_inode_hugepages has been added to the -mm mm-unstable branch. Its filename is mm-gup-introduce-memfd_pin_folios-for-pinning-memfd-folios-fix-2.patch This patch will shortly appear at https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/mm-gup-introduce-memfd_pin_folios-for-pinning-memfd-folios-fix-2.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: "Kasireddy, Vivek" <vivek.kasireddy@xxxxxxxxx> Subject: RE: [fs?] [mm?] INFO: task hung in remove_inode_hugepages Date: Mon Jul 8 23:04:48 2024 -0700 return -EINVAL if the end offset is greater than the size of memfd Link: https://lkml.kernel.org/r/IA0PR11MB71850525CBC7D541CAB45DF1F8DB2@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx Signed-off-by: Vivek Kasireddy <vivek.kasireddy@xxxxxxxxx> Reported-by: <syzbot+f1d7fb4f94764243d23e@xxxxxxxxxxxxxxxxxxxxxxxxx> Testted-by: <syzbot+f1d7fb4f94764243d23e@xxxxxxxxxxxxxxxxxxxxxxxxx> Cc: Dave Airlie <airlied@xxxxxxxxxx> Cc: Gerd Hoffmann <kraxel@xxxxxxxxxx> Cc: Muchun Song <muchun.song@xxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- mm/gup.c | 3 +++ 1 file changed, 3 insertions(+) --- a/mm/gup.c~mm-gup-introduce-memfd_pin_folios-for-pinning-memfd-folios-fix-2 +++ a/mm/gup.c @@ -3814,6 +3814,9 @@ long memfd_pin_folios(struct file *memfd if (!shmem_file(memfd) && !is_file_hugepages(memfd)) return -EINVAL; + if (end >= i_size_read(file_inode(memfd))) + return -EINVAL; + if (is_file_hugepages(memfd)) { h = hstate_file(memfd); pgshift = huge_page_shift(h); _ Patches currently in -mm which might be from vivek.kasireddy@xxxxxxxxx are mm-gup-introduce-unpin_folio-unpin_folios-helpers.patch mm-gup-introduce-check_and_migrate_movable_folios.patch mm-gup-introduce-memfd_pin_folios-for-pinning-memfd-folios.patch mm-gup-introduce-memfd_pin_folios-for-pinning-memfd-folios-fix-2.patch udmabuf-use-vmf_insert_pfn-and-vm_pfnmap-for-handling-mmap.patch udmabuf-add-back-support-for-mapping-hugetlb-pages.patch udmabuf-convert-udmabuf-driver-to-use-folios.patch udmabuf-pin-the-pages-using-memfd_pin_folios-api.patch selftests-udmabuf-add-tests-to-verify-data-after-page-migration.patch