Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 16 Jun 2024 16:20:07 GMT
From:      Bojan =?utf-8?Q?Novkovi=C4=87?= <bnovkov@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: 858ead4bcefb - main - powerpc_mmu_radix: Release PTP reference on leaf ptpage allocation failure
Message-ID:  <202406161620.45GGK7MB041972@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by bnovkov:

URL: https://cgit.FreeBSD.org/src/commit/?id=858ead4bcefb4657629cba29b0e4507db509ee36

commit 858ead4bcefb4657629cba29b0e4507db509ee36
Author:     Bojan Novković <bnovkov@FreeBSD.org>
AuthorDate: 2024-06-13 16:11:12 +0000
Commit:     Bojan Novković <bnovkov@FreeBSD.org>
CommitDate: 2024-06-16 16:19:27 +0000

    powerpc_mmu_radix: Release PTP reference on leaf ptpage allocation failure
    
    0013741 fixed an edge case invloving mlock() and superpage creation
    by creating and inserting a leaf pagetable page for mlock'd superpages.
    However, the code does not properly release the reference to the
    pagetable page in the error handling path.
    This commit fixes the issue by adding calls to 'pmap_abort_ptp'
    in the error handling path.
    
    Reported by: alc
    Approved by: markj (mentor)
    Fixes: 0013741
    Differential Revision: https://reviews.freebsd.org/D45582
---
 sys/powerpc/aim/mmu_radix.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/sys/powerpc/aim/mmu_radix.c b/sys/powerpc/aim/mmu_radix.c
index 746b1ef49a99..ae6e4d116e87 100644
--- a/sys/powerpc/aim/mmu_radix.c
+++ b/sys/powerpc/aim/mmu_radix.c
@@ -3268,12 +3268,15 @@ pmap_enter_l3e(pmap_t pmap, vm_offset_t va, pml3_entry_t newpde, u_int flags,
 	uwptpg = NULL;
 	if ((newpde & PG_W) != 0 && pmap != kernel_pmap) {
 		uwptpg = vm_page_alloc_noobj(VM_ALLOC_WIRED);
-		if (uwptpg == NULL)
+		if (uwptpg == NULL) {
+			pmap_abort_ptp(pmap, va, pdpg);
 			return (KERN_RESOURCE_SHORTAGE);
+		}
 		uwptpg->pindex = pmap_l3e_pindex(va);
 		if (pmap_insert_pt_page(pmap, uwptpg)) {
 			vm_page_unwire_noq(uwptpg);
 			vm_page_free(uwptpg);
+			pmap_abort_ptp(pmap, va, pdpg);
 			return (KERN_RESOURCE_SHORTAGE);
 		}
 		pmap_resident_count_inc(pmap, 1);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202406161620.45GGK7MB041972>