Skip to contentSkip to conversation

selftests-mm-fix-bug_on-checking-wrong-variable-in-mremap_dontunmap.patch removed from -mm tree

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

lore
Share & tools
lore

Andrew Morton

author tree notice Applied
#0 lore raw

The quilt patch titled
Subject: selftests/mm: fix BUG_ON checking wrong variable in mremap_dontunmap
has been removed from the -mm tree. Its filename was
selftests-mm-fix-bug_on-checking-wrong-variable-in-mremap_dontunmap.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: Hongfu Li <[email protected]>
Subject: selftests/mm: fix BUG_ON checking wrong variable in mremap_dontunmap
Date: Fri, 17 Jul 2026 15:02:51 +0800

In mremap_dontunmap_partial_mapping_overwrite(), mremap() stores its returned remapped address into remapped_mapping, while the BUG_ON incorrectly checks dest_mapping instead.

If mremap() fails, dest_mapping still holds a valid pointer obtained from the prior mmap() call, making this BUG_ON never trigger at all. Correct the check to validate the actual mremap() return value stored in remapped_mapping.

Cc David Hildenbrand <[email protected]>
Cc Liam R. Howlett <[email protected]>
Cc Lorenzo Stoakes <[email protected]>
Cc Michal Hocko <[email protected]>
Cc Mike Rapoport <[email protected]>
Cc Shuah Khan <[email protected]>
Cc Suren Baghdasaryan <[email protected]>
Cc Vlastimil Babka <[email protected]>

---

 tools/testing/selftests/mm/mremap_dontunmap.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/testing/selftests/mm/mremap_dontunmap.c renamed from tools/testing/selftests/mm/mremap_dontunmap.c~selftests-mm-fix-bug_on-checking-wrong-variable-in-mremap_dontunmap +1 -1
@@ -313,7 +313,7 @@ static void mremap_dontunmap_partial_map
 	    mremap(source_mapping, 5 * page_size,
 		   5 * page_size,
 		   MREMAP_DONTUNMAP | MREMAP_MAYMOVE | MREMAP_FIXED, dest_mapping);
-	BUG_ON(dest_mapping == MAP_FAILED, "mremap");
+	BUG_ON(remapped_mapping == MAP_FAILED, "mremap");
 	BUG_ON(dest_mapping != remapped_mapping, "expected to remap to dest_mapping");
 
 	BUG_ON(check_region_contains_byte(source_mapping, 5 * page_size, 0) !=

_

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

mm-swap-fix-swap_cluster_lock-config_swap-stub-signature-mismatch.patch ksm-update-comments-and-docs-to-reference-folio-mapping.patch mm-use-a-folio-in-the-softleaf_is_device_private-path.patch selftests-mm-drop-duplicate-test_seal_mprotect_two_vma_with_gap-call.patch selftests-prctl-fix-non-anonymous-vma-mapping-in-set-anon-vma-name-test.patch