Skip to content
Snippets Groups Projects
Commit 70ac60b0 authored by Zhaoyang Huang's avatar Zhaoyang Huang Committed by Todd Kjos
Browse files

FROMGIT: mm: gup: fix infinite loop within __get_longterm_locked

We can run into an infinite loop in __get_longterm_locked() when
collect_longterm_unpinnable_folios() finds only folios that are isolated
from the LRU or were never added to the LRU. This can happen when all
folios to be pinned are never added to the LRU, for example when
vm_ops->fault allocated pages using cma_alloc() and never added them to
the LRU.

Fix it by simply taking a look at the list in the single caller, to see
if anything was added.

Fixes: 67e139b0 ("mm/gup.c: refactor check_and_migrate_movable_pages()")

Bug: 391066044
Link: https://lkml.kernel.org/r/20250121020159.3636477-1-zhaoyang.huang@unisoc.com
(cherry picked from commit 1aaf8c12
repo https://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm.git


branch mm-hotfixes-stable)
Change-Id: I90c0a8df0581a42adc30a9cb5e8e91064b60f192
Reviewed-by: default avatarJohn Hubbard <jhubbard@nvidia.com>
Suggested-by: default avatarDavid Hildenbrand <david@redhat.com>
Signed-off-by: default avatarZhaoyang Huang <zhaoyang.huang@unisoc.com>
parent 95737ba9
No related branches found
No related tags found
No related merge requests found
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment