git: 5d4545a2270e - main - arm64 pmap: Release PTP reference on leaf ptpage allocation failure
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sun, 16 Jun 2024 16:20:05 UTC
The branch main has been updated by bnovkov: URL: https://cgit.FreeBSD.org/src/commit/?id=5d4545a2270e9d6c37c0a580c010c579ccdfa129 commit 5d4545a2270e9d6c37c0a580c010c579ccdfa129 Author: Bojan Novković <bnovkov@FreeBSD.org> AuthorDate: 2024-06-13 15:59:29 +0000 Commit: Bojan Novković <bnovkov@FreeBSD.org> CommitDate: 2024-06-16 16:19:26 +0000 arm64 pmap: Release PTP reference on leaf ptpage allocation failure 808f5ac 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: 808f5ac Differential Revision: https://reviews.freebsd.org/D45578 --- sys/arm64/arm64/pmap.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sys/arm64/arm64/pmap.c b/sys/arm64/arm64/pmap.c index 7b30b2a6ae37..e8991ae706f9 100644 --- a/sys/arm64/arm64/pmap.c +++ b/sys/arm64/arm64/pmap.c @@ -5545,12 +5545,14 @@ pmap_enter_l2(pmap_t pmap, vm_offset_t va, pd_entry_t new_l2, u_int flags, if ((new_l2 & ATTR_SW_WIRED) != 0 && pmap != kernel_pmap) { uwptpg = vm_page_alloc_noobj(VM_ALLOC_WIRED); if (uwptpg == NULL) { + pmap_abort_ptp(pmap, va, l2pg); return (KERN_RESOURCE_SHORTAGE); } uwptpg->pindex = pmap_l2_pindex(va); if (pmap_insert_pt_page(pmap, uwptpg, true, false)) { vm_page_unwire_noq(uwptpg); vm_page_free(uwptpg); + pmap_abort_ptp(pmap, va, l2pg); return (KERN_RESOURCE_SHORTAGE); } pmap_resident_count_inc(pmap, 1);