aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJustin Hibbits <jhibbits@FreeBSD.org>2023-03-21 13:18:18 +0000
committerJustin Hibbits <jhibbits@FreeBSD.org>2023-03-21 13:56:26 +0000
commit379e14ba6c61634cc1f50272b6f8f147758ec92f (patch)
treef88587141aa1e60c687d2d76e1c6f910ad162d99
parentdaa0b64a226031d5f753f96cd5a6fb3234cdd8b1 (diff)
downloadsrc-379e14ba6c61634cc1f50272b6f8f147758ec92f.tar.gz
src-379e14ba6c61634cc1f50272b6f8f147758ec92f.zip
powerpc/pmap: Account for a potential NULL pmap in pmap_sync_icache
It's apparently possible for pcpu->pc_curpmap to be NULL at some point, leading to a panic. Account for this as is done with the other 64-bit AIM pmap. Reported by: pkubaj Tested by: pkubaj Fixes: 6f0b2a235a1 ("Add pmap_sync_icache() for radix pmap") MFC after: 3 days
-rw-r--r--sys/powerpc/aim/mmu_radix.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/sys/powerpc/aim/mmu_radix.c b/sys/powerpc/aim/mmu_radix.c
index 1e7661ba8068..c95de527f554 100644
--- a/sys/powerpc/aim/mmu_radix.c
+++ b/sys/powerpc/aim/mmu_radix.c
@@ -5929,6 +5929,9 @@ mmu_radix_sync_icache(pmap_t pm, vm_offset_t va, vm_size_t sz)
vm_paddr_t pa = 0;
int sync_sz;
+ if (__predict_false(pm == NULL))
+ pm = &curthread->td_proc->p_vmspace->vm_pmap;
+
while (sz > 0) {
pa = pmap_extract(pm, va);
sync_sz = PAGE_SIZE - (va & PAGE_MASK);