mirror of
https://github.com/freebsd/freebsd-src
synced 2024-10-01 14:14:56 +00:00
riscv pmap: Release PTP reference on leaf ptpage allocation failure
d0941ed
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:d0941ed
Differential Revision: https://reviews.freebsd.org/D45580
This commit is contained in:
parent
e8816b4b66
commit
774549fe06
|
@ -3291,12 +3291,14 @@ pmap_enter_l2(pmap_t pmap, vm_offset_t va, pd_entry_t new_l2, u_int flags,
|
|||
if ((new_l2 & PTE_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);
|
||||
|
|
Loading…
Reference in a new issue