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:		6f0b2a235a ("Add pmap_sync_icache() for radix pmap")
MFC after:	3 days
This commit is contained in:
Justin Hibbits 2023-03-21 09:18:18 -04:00 committed by Oscar Zhao
parent b177aa936f
commit ca90fd1686

View File

@ -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);