]> xenbits.xensource.com Git - xen.git/commitdiff
x86/mm: Fix locking on hap enable failure
authorAndres Lagar-Cavilla <andres@lagarcavilla.org>
Wed, 18 Apr 2012 12:38:47 +0000 (13:38 +0100)
committerAndres Lagar-Cavilla <andres@lagarcavilla.org>
Wed, 18 Apr 2012 12:38:47 +0000 (13:38 +0100)
If enabling hap fails due to out of memory, the locking on the clean up path is
broken.

Signed-off-by: Andres Lagar-Cavilla <andres@lagarcavilla.org>
Acked-by: Tim Deegan <tim@xen.org>
Committed-by: Tim Deegan <tim@xen.org>
xen/arch/x86/mm/hap/hap.c

index 4ad21db59be23f4dd18d16cead03e708113758ea..13b4be211a2a4d560c791eabfcdad14ae3b4592e 100644 (file)
@@ -585,13 +585,14 @@ int hap_enable(struct domain *d, u32 mode)
         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 */