Skip to contentSkip to conversation

mm-memoryc-fix-potential-pte_unmap_unlock-pte-error.patch removed from -mm tree

merged [email protected] 1 participant 1 message Feb 25, 2021

lore
Share & tools
lore

[email protected]

author tree notice Applied
#0 lore raw

The patch titled
Subject: mm/memory.c: fix potential pte_unmap_unlock pte error
has been removed from the -mm tree. Its filename was
mm-memoryc-fix-potential-pte_unmap_unlock-pte-error.patch

This patch was dropped because it was merged into mainline or a subsystem tree

------------------------------------------------------
From: Miaohe Lin <[email protected]>
Subject: mm/memory.c: fix potential pte_unmap_unlock pte error

If all pte entry is none in 'non-create' case, we would break the loop with pte unchanged. Then the wrong pte - 1 would be passed to pte_unmap_unlock. This is a theoretical issue which may not be a real bug. So it's not worth cc stable.

Fixes aee16b3cee27 ("Add apply_to_page_range() which applies a function to a pte range")
Cc Ingo Molnar <[email protected]>
Cc Ian Pratt <[email protected]>
Cc Chris Wright <[email protected]>

---

 mm/memory.c |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
mm/memory.c renamed from mm/memory.c~mm-memoryc-fix-potential-pte_unmap_unlock-pte-error +4 -4
@@ -2394,18 +2394,18 @@ static int apply_to_pte_range(struct mm_
 				     pte_fn_t fn, void *data, bool create,
 				     pgtbl_mod_mask *mask)
 {
-	pte_t *pte;
+	pte_t *pte, *mapped_pte;
 	int err = 0;
 	spinlock_t *ptl;
 
 	if (create) {
-		pte = (mm == &init_mm) ?
+		mapped_pte = pte = (mm == &init_mm) ?
 			pte_alloc_kernel_track(pmd, addr, mask) :
 			pte_alloc_map_lock(mm, pmd, addr, &ptl);
 		if (!pte)
 			return -ENOMEM;
 	} else {
-		pte = (mm == &init_mm) ?
+		mapped_pte = pte = (mm == &init_mm) ?
 			pte_offset_kernel(pmd, addr) :
 			pte_offset_map_lock(mm, pmd, addr, &ptl);
 	}
@@ -2428,7 +2428,7 @@ static int apply_to_pte_range(struct mm_
 	arch_leave_lazy_mmu_mode();
 
 	if (mm != &init_mm)
-		pte_unmap_unlock(pte-1, ptl);
+		pte_unmap_unlock(mapped_pte, ptl);
 	return err;
 }
 

_

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

mm-memory_hotplug-use-helper-function-zone_end_pfn-to-get-end_pfn.patch mm-mlock-stop-counting-mlocked-pages-when-none-vma-is-found.patch mm-rmap-correct-some-obsolete-comments-of-anon_vma.patch mm-rmap-remove-unneeded-semicolon-in-page_not_mapped.patch mm-rmap-fix-obsolete-comment-in-__page_check_anon_rmap.patch mm-rmap-use-page_not_mapped-in-try_to_unmap.patch mm-rmap-correct-obsolete-comment-of-page_get_anon_vma.patch mm-rmap-fix-potential-pte_unmap-on-an-not-mapped-pte.patch mm-zsmallocc-convert-to-use-kmem_cache_zalloc-in-cache_alloc_zspage.patch mm-zsmallocc-use-page_private-to-access-page-private.patch