diff mbox series

[v3,1/6] migrate: Allow migrate_misplaced_folio_prepare() to accept a NULL VMA.

Message ID 20250107000346.1338481-2-gourry@gourry.net (mailing list archive)
State New
Headers show
Series Promotion of Unmapped Page Cache Folios. | expand

Commit Message

Gregory Price Jan. 7, 2025, 12:03 a.m. UTC
migrate_misplaced_folio_prepare() may be called on a folio without
a VMA, and so it must be made to accept a NULL VMA.

Suggested-by: Johannes Weiner <hannes@cmpxchg.org>
Signed-off-by: Gregory Price <gourry@gourry.net>
---
 mm/migrate.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/mm/migrate.c b/mm/migrate.c
index caadbe393aa2..ea20d9bc4f40 100644
--- a/mm/migrate.c
+++ b/mm/migrate.c
@@ -2627,7 +2627,7 @@  int migrate_misplaced_folio_prepare(struct folio *folio,
 		 * See folio_likely_mapped_shared() on possible imprecision
 		 * when we cannot easily detect if a folio is shared.
 		 */
-		if ((vma->vm_flags & VM_EXEC) &&
+		if (vma && (vma->vm_flags & VM_EXEC) &&
 		    folio_likely_mapped_shared(folio))
 			return -EACCES;