riscv/addrenv_shm: Add missing sanity check to up_shmdt()

A missing sanity check, make sure the last level page table actually exists
before trying to clear entries from it.
This commit is contained in:
Ville Juven 2023-01-17 16:00:51 +02:00 committed by Xiang Xiao
parent fa6ba05097
commit 58b5a0412e

View File

@ -159,6 +159,10 @@ int up_shmdt(uintptr_t vaddr, unsigned int npages)
paddr = mmu_pte_to_paddr(mmu_ln_getentry(ptlevel, ptprev, vaddr));
ptlast = riscv_pgvaddr(paddr);
if (!ptlast)
{
return -EFAULT;
}
/* Then wipe the reference */