[merged mm-stable] lib-test_hmm-fail-dmirror_fault-when-the-mirrored-mm-is-gone.patch removed from -mm tree

Andrew Morton <[email protected]> Thu, 30 Jul 2026 19:42:33 -0700
Newsgroups org.kernel.vger.mm-commits
Message-ID <[email protected]>
The quilt patch titled
     Subject: lib/test_hmm: fail dmirror_fault() when the mirrored mm is gone
has been removed from the -mm tree.  Its filename was
     lib-test_hmm-fail-dmirror_fault-when-the-mirrored-mm-is-gone.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: Stanislav Kinsburskii <[email protected]>
Subject: lib/test_hmm: fail dmirror_fault() when the mirrored mm is gone
Date: Wed, 01 Jul 2026 15:02:20 -0700

dmirror_fault() is called from the dmirror_read() and dmirror_write()
retry loops after dmirror_do_read() or dmirror_do_write() finds a missing
device page table entry.

If the mirrored mm has already exited, mmget_not_zero() fails.  The
current code returns 0 in that case, which tells the caller that faulting
succeeded even though no page was faulted and no device page table entry
was installed.  The caller then retries the same address, hits -ENOENT
again, and can loop forever without making progress.

Return -EFAULT instead, so the ioctl fails when the mirrored mm is no
longer faultable.

Link: https://lore.kernel.org/178294308408.327222.3319445682023999403.stgit@skinsburskii
Fixes: b2ef9f5a5cb37 ("mm/hmm/test: add selftest driver for HMM")
Signed-off-by: Stanislav Kinsburskii <[email protected]>
Cc: Jason Gunthorpe <[email protected]>
Cc: Leon Romanovsky <[email protected]>
Cc: Ralph Campbell <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
---

 lib/test_hmm.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/lib/test_hmm.c~lib-test_hmm-fail-dmirror_fault-when-the-mirrored-mm-is-gone
+++ a/lib/test_hmm.c
@@ -407,7 +407,7 @@ static int dmirror_fault(struct dmirror
 
 	/* Since the mm is for the mirrored process, get a reference first. */
 	if (!mmget_not_zero(mm))
-		return 0;
+		return -EFAULT;
 
 	for (addr = start; addr < end; addr = range.end) {
 		range.start = addr;
_

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