mm-gup-memfd-stop-leaking-pinned-pages-in-low-memory-conditions.patch removed from -mm tree
The quilt patch titled
Subject: mm/gup: memfd: stop leaking pinned pages in low memory conditions
has been removed from the -mm tree. Its filename was
mm-gup-memfd-stop-leaking-pinned-pages-in-low-memory-conditions.patch
This patch was dropped because it was merged into the mm-hotfixes-stable branch of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
------------------------------------------------------
From: John Hubbard <[email protected]>
Subject: mm/gup: memfd: stop leaking pinned pages in low memory conditions
Date: Thu, 17 Oct 2024 18:17:11 -0700
If check_and_migrate_movable_pages() fails, typically with -ENOMEM, then memfd_pin_folios() will leave pages pinned. Those are leaked forever, and are visible to user space as a memory leak.
Fix this by unpinning the folios that try_grab_folio(FOLL_PIN) has pinned, in such error cases.
---
mm/gup.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)
mm/gup.c renamed from mm/gup.c~mm-gup-memfd-stop-leaking-pinned-pages-in-low-memory-conditions +3 -5
@@ -3724,12 +3724,10 @@ long memfd_pin_folios(struct file *memfd ret =check_and_migrate_movable_folios (nr_folios, folios); }while (ret == -EAGAIN ); -memalloc_pin_restore (flags); -return ret ? ret : nr_folios; err:memalloc_pin_restore (flags); -unpin_folios (folios, nr_folios); - -return ret; +if (ret) +unpin_folios (folios, nr_folios); +return ret ? ret : nr_folios; }EXPORT_SYMBOL_GPL (memfd_pin_folios);
_
Patches currently in -mm which might be from [email protected] are
kaslr-rename-physmem_end-and-physmem_end-to-direct_map_physmem_end.patch