From: Tim Deegan Date: Thu, 20 Oct 2011 14:36:01 +0000 (+0100) Subject: x86/mm/p2m: don't leak state if nested-p2m init fails. X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=a8a8a52a27513b35d1c6aa2d542074f99849ac3d;p=xen.git x86/mm/p2m: don't leak state if nested-p2m init fails. Signed-off-by: Tim Deegan --- diff --git a/xen/arch/x86/mm/p2m.c b/xen/arch/x86/mm/p2m.c index 4a8688acb6..785ef963d3 100644 --- a/xen/arch/x86/mm/p2m.c +++ b/xen/arch/x86/mm/p2m.c @@ -113,6 +113,7 @@ p2m_init_nestedp2m(struct domain *d) int p2m_init(struct domain *d) { struct p2m_domain *p2m; + int rc; p2m_get_hostp2m(d) = p2m = xzalloc(struct p2m_domain); if ( p2m == NULL ) @@ -121,9 +122,11 @@ int p2m_init(struct domain *d) /* Must initialise nestedp2m unconditionally * since nestedhvm_enabled(d) returns false here. - * (p2m_init runs too early for HVM_PARAM_* options) - */ - return p2m_init_nestedp2m(d); + * (p2m_init runs too early for HVM_PARAM_* options) */ + rc = p2m_init_nestedp2m(d); + if ( rc ) + p2m_final_teardown(d); + return rc; } void p2m_change_entry_type_global(struct domain *d,