Changes since v1 [1]: 1) Thanks to David Hildenbrand for this part: added a second patch to fix the same issue (incomplete error handling for the return value from check_and_migrate_movable_folios()), but this time in memfd_pin_folios(). Please note that I am not set up to test memfd things, so at this point all I can claim is that patch #2 doesn't prevent my test machine from booting. :) 2) Fixed a typo in the comment, in the first patch. 3) Added review and ack tags. [1] https://lore.kernel.org/20241016202242.456953-1-jhubbard@xxxxxxxxxx Cc: "Matthew Wilcox (Oracle)" <willy@xxxxxxxxxxxxx> Cc: Alistair Popple <apopple@xxxxxxxxxx> Cc: Arnd Bergmann <arnd@xxxxxxxx> Cc: Christoph Hellwig <hch@xxxxxxxxxxxxx> Cc: Daniel Vetter <daniel.vetter@xxxxxxxx> Cc: Dave Airlie <airlied@xxxxxxxxxx> Cc: David Hildenbrand <david@xxxxxxxxxx> Cc: Dongwon Kim <dongwon.kim@xxxxxxxxx> Cc: Gerd Hoffmann <kraxel@xxxxxxxxxx> Cc: Hugh Dickins <hughd@xxxxxxxxxx> Cc: Jason Gunthorpe <jgg@xxxxxxxxxx> Cc: Junxiao Chang <junxiao.chang@xxxxxxxxx> Cc: Mike Kravetz <mike.kravetz@xxxxxxxxxx> Cc: Minchan Kim <minchan@xxxxxxxxxx> Cc: Oscar Salvador <osalvador@xxxxxxx> Cc: Pasha Tatashin <pasha.tatashin@xxxxxxxxxx> Cc: Peter Xu <peterx@xxxxxxxxxx> Cc: Shigeru Yoshida <syoshida@xxxxxxxxxx> Cc: Vivek Kasireddy <vivek.kasireddy@xxxxxxxxx> John Hubbard (2): mm/gup: stop leaking pinned pages in low memory conditions mm/gup: memfd: stop leaking pinned pages in low memory conditions mm/gup.c | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) base-commit: 274995ffe748bbee39f1ca65c6a31a1800140b27 -- 2.47.0