mirror of
https://github.com/opnsense/src.git
synced 2026-03-29 06:03:14 -04:00
powerpc/pmap: Tighten condition for removing tracked pages in Book-E pmap
There are cases where there's no vm_page_t structure for a given physical address, such as the CCSR. In this case, trying to obtain the md.page_tracked struct member would lead to a NULL dereference, and panic. Tighten this up by checking for kernel_pmap AND that the page structure actually exists before dereferencing. The flag can only be set when it's tracked in the kernel pmap anyway. MFC after: 3 weeks
This commit is contained in:
parent
d6e23cf0cf
commit
ec17d5e06a
1 changed files with 2 additions and 2 deletions
|
|
@ -1177,7 +1177,7 @@ pte_remove(mmu_t mmu, pmap_t pmap, vm_offset_t va, u_int8_t flags)
|
|||
|
||||
/* Remove pv_entry from pv_list. */
|
||||
pv_remove(pmap, va, m);
|
||||
} else if (m->md.pv_tracked) {
|
||||
} else if (pmap == kernel_pmap && m && m->md.pv_tracked) {
|
||||
pv_remove(pmap, va, m);
|
||||
if (TAILQ_EMPTY(&m->md.pv_list))
|
||||
m->md.pv_tracked = false;
|
||||
|
|
@ -1373,7 +1373,7 @@ pte_remove(mmu_t mmu, pmap_t pmap, vm_offset_t va, uint8_t flags)
|
|||
vm_page_aflag_set(m, PGA_REFERENCED);
|
||||
|
||||
pv_remove(pmap, va, m);
|
||||
} else if (m->md.pv_tracked) {
|
||||
} else if (pmap == kernel_pmap && m && m->md.pv_tracked) {
|
||||
/*
|
||||
* Always pv_insert()/pv_remove() on MPC85XX, in case DPAA is
|
||||
* used. This is needed by the NCSW support code for fast
|
||||
|
|
|
|||
Loading…
Reference in a new issue