File 57238c1e-x86-fix-domain-cleanup.patch of Package xen.4218
References: bsc#976058
# Commit a29e895b2bde17ab239da3bff76ec00c8d9b2e77
# Date 2016-04-29 18:30:22 +0200
# Author Jan Beulich <jbeulich@suse.com>
# Committer Jan Beulich <jbeulich@suse.com>
x86: fix domain cleanup
Free d->arch.cpuids on both the creation error path and during
destruction.
Avoid unintentionally bypassing iommu_domain_destroy().
Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
--- a/xen/arch/x86/domain.c
+++ b/xen/arch/x86/domain.c
@@ -616,10 +616,7 @@ int arch_domain_create(struct domain *d,
if ( has_hvm_container_domain(d) )
{
if ( (rc = hvm_domain_initialise(d)) != 0 )
- {
- iommu_domain_destroy(d);
goto fail;
- }
}
else
/* 64-bit PV guest by default. */
@@ -642,8 +639,10 @@ int arch_domain_create(struct domain *d,
fail:
d->is_dying = DOMDYING_dead;
+ iommu_domain_destroy(d);
cleanup_domain_irq_mapping(d);
free_xenheap_page(d->shared_info);
+ xfree(d->arch.cpuids);
if ( paging_initialised )
paging_final_teardown(d);
free_perdomain_mappings(d);
@@ -658,6 +657,7 @@ void arch_domain_destroy(struct domain *
hvm_domain_destroy(d);
xfree(d->arch.e820);
+ xfree(d->arch.cpuids);
free_domain_pirqs(d);
if ( !is_idle_domain(d) )