Skip to contentSkip to conversation

x86/mm: Fix locking on hap enable failure

PATCH Applied Andres Lagar-Cavilla 2 participants 2 messages Apr 13, 2012 – Apr 18, 2012

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86/mm: Fix locking on hap enable failure

 xen/arch/x86/mm/hap/hap.c |  3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

If enabling hap fails due to out of memory, the locking on the clean up path is broken.

xen/arch/x86/mm/hap/hap.c +2 -1
diff -r 8ec52231c03d -r 15a3c740419f xen/arch/x86/mm/hap/hap.c
@@ -585,13 +585,14 @@ int hap_enable(struct domain *d, u32 mod
         unsigned int r;
         paging_lock(d);
         r = hap_set_allocation(d, 256, NULL);
-        paging_unlock(d);
         if ( r != 0 )
         {
             hap_set_allocation(d, 0, NULL);
+            paging_unlock(d);
             rv = -ENOMEM;
             goto out;
         }
+        paging_unlock(d);
     }
 
     /* Allow p2m and log-dirty code to borrow our memory */
Applied
#1 lore raw
Quoted 8 lines · Andres Lagar-Cavilla
 xen/arch/x86/mm/hap/hap.c |  3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

If enabling hap fails due to out of memory, the locking on the clean up path is broken.

Applied, thanks.

Tim.