[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[xen staging-4.14] x86/HVM: re-order error path of hvm_domain_initialise()



commit 3d09a43f75a7ad0d24b460d9ba6130da637ffeed
Author:     Jan Beulich <jbeulich@xxxxxxxx>
AuthorDate: Fri Mar 5 15:28:57 2021 +0100
Commit:     Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Fri Mar 5 15:28:57 2021 +0100

    x86/HVM: re-order error path of hvm_domain_initialise()
    
    hvm_destroy_all_ioreq_servers(), called from
    hvm_domain_relinquish_resources(), invokes relocate_portio_handler(),
    which uses d->arch.hvm.io_handler. Defer freeing of this array
    accordingly on the error path of hvm_domain_initialise().
    
    Similarly rtc_deinit() requires d->arch.hvm.pl_time to still be around,
    or else an armed timer structure would get freed, and that timer never
    get killed.
    
    Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
    Acked-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
    master commit: fbb3bf002b42803ef289ea2a649ebd5f25d22236
    master date: 2021-01-29 11:36:54 +0100
---
 xen/arch/x86/hvm/hvm.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c
index 3001e7442b..ab45b0a588 100644
--- a/xen/arch/x86/hvm/hvm.c
+++ b/xen/arch/x86/hvm/hvm.c
@@ -714,15 +714,15 @@ int hvm_domain_initialise(struct domain *d)
  fail1:
     if ( is_hardware_domain(d) )
         xfree(d->arch.hvm.io_bitmap);
-    XFREE(d->arch.hvm.io_handler);
     XFREE(d->arch.hvm.params);
-    XFREE(d->arch.hvm.pl_time);
     XFREE(d->arch.hvm.irq);
  fail0:
     hvm_destroy_cacheattr_region_list(d);
     destroy_perdomain_mapping(d, PERDOMAIN_VIRT_START, 0);
  fail:
     hvm_domain_relinquish_resources(d);
+    XFREE(d->arch.hvm.io_handler);
+    XFREE(d->arch.hvm.pl_time);
     return rc;
 }
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.14



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.