summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorStanislav Kinsburskii <skinsburskii@linux.microsoft.com>2026-07-01 15:02:20 -0700
committerAndrew Morton <akpm@linux-foundation.org>2026-07-22 21:12:03 -0700
commit2671aa71a02b79c96245d7060b59c5cd7e984f54 (patch)
tree4b9ace2a9c435897dc315b5680f687ccc1ea1be6 /lib
parent639b2c8d9a5942d573f2b730e2205f9383b8e2a5 (diff)
downloadlinux-next-2671aa71a02b79c96245d7060b59c5cd7e984f54.tar.gz
linux-next-2671aa71a02b79c96245d7060b59c5cd7e984f54.zip
lib/test_hmm: fail dmirror_fault() when the mirrored mm is gone
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 <skinsburskii@linux.microsoft.com> Cc: Jason Gunthorpe <jgg@ziepe.ca> Cc: Leon Romanovsky <leon@kernel.org> Cc: Ralph Campbell <rcampbell@nvidia.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Diffstat (limited to 'lib')
-rw-r--r--lib/test_hmm.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/test_hmm.c b/lib/test_hmm.c
index c4adbf98fac7..45c0cb992218 100644
--- a/lib/test_hmm.c
+++ b/lib/test_hmm.c
@@ -407,7 +407,7 @@ static int dmirror_fault(struct dmirror *dmirror, unsigned long start,
/* 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;