Skip to contentSkip to conversation

mm-fail-the-fault-on-a-malformed-swap-entry-instead-of-retrying-it.patch removed from -mm tree

merged mm-stable Andrew Morton 1 participant 1 message Oct 7

lore
Share & tools
lore

Andrew Morton

author tree notice Applied
#0 lore raw

The quilt patch titled
Subject: mm: fail the fault on a malformed swap entry instead of retrying it
has been removed from the -mm tree. Its filename was
mm-fail-the-fault-on-a-malformed-swap-entry-instead-of-retrying-it.patch

This patch was dropped because it was merged into the mm-stable branch of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm

------------------------------------------------------
From: Breno Leitao <[email protected]>
Subject: mm: fail the fault on a malformed swap entry instead of retrying it
Date: Tue, 18 Aug 2026 03:06:24 -0700

do_swap_page() returns 0 when get_swap_device() fails, which the fault handler reads as "handled". For an entry that can never become valid the retry takes the same fault again, so the thread spins forever, retrying on the same fault.

Return VM_FAULT_SIGBUS (Bad access) for a malformed entry (pr_err() was called at get_swap_device()).

Cc Baolin Wang <[email protected]>
Cc Baoquan He <[email protected]>
Cc Chengming Zhou <[email protected]>
Cc Chris Li <[email protected]>
Cc Hugh Dickins <[email protected]>
Cc Jann Horn <[email protected]>
Cc Johannes Weiner <[email protected]>
Cc Kemeng Shi <[email protected]>
Cc Liam R. Howlett <[email protected]>
Cc Lorenzo Stoakes <[email protected]>
Cc Michal Hocko <[email protected]>
Cc Mike Rapoport <[email protected]>
Cc Pedro Falcato <[email protected]>
Cc Peter Xu <[email protected]>
Cc Suren Baghdasaryan <[email protected]>
Cc Vlastimil Babka <[email protected]>

---

 mm/memory.c |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
mm/memory.c renamed from mm/memory.c~mm-fail-the-fault-on-a-malformed-swap-entry-instead-of-retrying-it +4 -1
@@ -4958,8 +4958,11 @@ vm_fault_t do_swap_page(struct vm_fault
 
 	/* Prevent swapoff from happening to us, and reject a bad entry. */
 	si = get_swap_device(entry);
-	if (IS_ERR_OR_NULL(si))
+	if (IS_ERR_OR_NULL(si)) {
+		if (IS_ERR(si))
+			ret = VM_FAULT_SIGBUS;
 		goto out;
+	}
 
 	folio = swap_cache_get_folio(entry);
 	if (folio)

_

Patches currently in -mm which might be from [email protected] are

documentation-kmemleak-describe-the-metadata-pool-not-the-early-log.patch documentation-kmemleak-fix-stale-statements-about-scanning.patch mm-kmemleak-raise-min_unref_scans-to-3-for-verbose-auto-scan.patch mm-shmem-report-rcu-tasks-quiescent-states-while-undoing-a-range.patch mm-kmemleak-move-the-struct-page-scan-into-a-helper.patch mm-kmemleak-scan-the-struct-page-array-in-max_scan_size-batches.patch