kernel - Fix rare pmap_scan_callback() panic
authorMatthew Dillon <dillon@apollo.backplane.com>
Sun, 27 May 2018 15:45:28 +0000 (08:45 -0700)
committerMatthew Dillon <dillon@apollo.backplane.com>
Sun, 27 May 2018 15:45:28 +0000 (08:45 -0700)
* Fix a panic where pmap_scan_callback() can sometimes call
  pv_put() with a NULL pd_pv.

sys/platform/pc64/x86_64/pmap.c

index 3d4f621..02b58dc 100644 (file)
@@ -4668,8 +4668,10 @@ kernel_skip:
                        pte_pv = pv_get_try(pmap, pmap_pte_pindex(sva),
                                            &pte_placemark, &error);
                        if (error) {
-                               pv_put(pd_pv);          /* lock order */
-                               pd_pv = NULL;
+                               if (pd_pv) {
+                                       pv_put(pd_pv);  /* lock order */
+                                       pd_pv = NULL;
+                               }
                                if (pt_pv) {
                                        pv_put(pt_pv);  /* lock order */
                                        pt_pv = NULL;