From: Andres Lagar-Cavilla Date: Wed, 18 Apr 2012 12:38:47 +0000 (+0100) Subject: x86/mm: Fix locking on hap enable failure X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=274075f331f0f68bcac49d07422bb5098b3436c5;p=xen.git x86/mm: Fix locking on hap enable failure If enabling hap fails due to out of memory, the locking on the clean up path is broken. Signed-off-by: Andres Lagar-Cavilla Acked-by: Tim Deegan Committed-by: Tim Deegan --- diff --git a/xen/arch/x86/mm/hap/hap.c b/xen/arch/x86/mm/hap/hap.c index 4ad21db59b..13b4be211a 100644 --- a/xen/arch/x86/mm/hap/hap.c +++ b/xen/arch/x86/mm/hap/hap.c @@ -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 */