Author: jhibbits
Date: Sun Oct 13 19:33:00 2019
New Revision: 353481
URL: https://svnweb.freebsd.org/changeset/base/353481

Log:
  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

Modified:
  head/sys/powerpc/booke/pmap.c

Modified: head/sys/powerpc/booke/pmap.c
==============================================================================
--- head/sys/powerpc/booke/pmap.c       Sun Oct 13 18:17:08 2019        
(r353480)
+++ head/sys/powerpc/booke/pmap.c       Sun Oct 13 19:33:00 2019        
(r353481)
@@ -1177,7 +1177,7 @@ pte_remove(mmu_t mmu, pmap_t pmap, vm_offset_t va, u_i
 
                /* 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, uin
                        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
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to