[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] Fix a missed unmap in __entry().



# HG changeset patch
# User kaf24@xxxxxxxxxxxxxxxxxxxx
# Node ID cc9ed0eea55aa7b4a2e014f11d97b2e6cac113eb
# Parent  d741fa2723094a51274466e91b71c13291732e94
Fix a missed unmap in __entry().
On x86_32p, after several creation/destroy of VMX domain, xen crashes
because we forget to unmap phys_table.

Signed-off-by: Xin Li <xin.b.li@xxxxxxxxx>

diff -r d741fa272309 -r cc9ed0eea55a xen/include/asm-x86/shadow_64.h
--- a/xen/include/asm-x86/shadow_64.h   Mon Feb 27 15:14:11 2006
+++ b/xen/include/asm-x86/shadow_64.h   Mon Feb 27 15:20:23 2006
@@ -223,6 +223,7 @@
     int i;
     pgentry_64_t *le_e;
     pgentry_64_t *le_p = NULL;
+    pgentry_64_t *phys_vtable = NULL;
     unsigned long mfn;
     int index;
     u32 level = flag & L_MASK;
@@ -251,25 +252,35 @@
     {
         root_level = PAE_PAGING_LEVELS;
         index = table_offset_64(va, root_level);
-        le_e = (pgentry_64_t *)map_domain_page(
+        phys_vtable = (pgentry_64_t *)map_domain_page(
             pagetable_get_pfn(v->domain->arch.phys_table));
+        le_e = &phys_vtable[index];
     }
 
     /*
      * If it's not external mode, then mfn should be machine physical.
      */
-    for (i = root_level - level; i > 0; i--) {
-        if ( unlikely(!(entry_get_flags(*le_e) & _PAGE_PRESENT)) ) {
+    for ( i = root_level - level; i > 0; i-- )
+    {
+        if ( unlikely(!(entry_get_flags(*le_e) & _PAGE_PRESENT)) )
+        {
             if ( le_p )
                 unmap_domain_page(le_p);
+
+            if ( phys_vtable )
+                unmap_domain_page(phys_vtable);
+
             return 0;
         }
+
         mfn = entry_get_pfn(*le_e);
         if ( (flag & GUEST_ENTRY) && shadow_mode_translate(d) )
             mfn = get_mfn_from_gpfn(mfn);
+
         if ( le_p )
             unmap_domain_page(le_p);
         le_p = (pgentry_64_t *)map_domain_page(mfn);
+
         if ( flag & SHADOW_ENTRY )
             index = table_offset_64(va, (level + i - 1));
         else
@@ -285,8 +296,10 @@
     if ( le_p )
         unmap_domain_page(le_p);
 
+    if ( phys_vtable )
+        unmap_domain_page(phys_vtable);
+
     return 1;
-
 }
 
 static inline int __rw_entry(

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.