From: Peter Dinda Date: Sun, 20 Sep 2015 20:51:07 +0000 (-0500) Subject: Correct VM deallocation on fail before nested paging init X-Git-Url: http://v3vee.org/palacios/gitweb/gitweb.cgi?a=commitdiff_plain;h=42b80fddfbfea5c5603b71d80d3e2ba2a53a2074;p=palacios.git Correct VM deallocation on fail before nested paging init --- diff --git a/palacios/include/palacios/vmm_direct_paging.h b/palacios/include/palacios/vmm_direct_paging.h index fc9d924..6e1a3b5 100644 --- a/palacios/include/palacios/vmm_direct_paging.h +++ b/palacios/include/palacios/vmm_direct_paging.h @@ -111,6 +111,7 @@ struct v3_nested_impl_state { // The externally visible state is just the callbacks v3_rw_lock_t event_callback_lock; struct list_head event_callback_list; + int inited; }; int v3_init_nested_paging(struct v3_vm_info *vm); diff --git a/palacios/src/palacios/vmm_direct_paging.c b/palacios/src/palacios/vmm_direct_paging.c index b747ef1..716e029 100644 --- a/palacios/src/palacios/vmm_direct_paging.c +++ b/palacios/src/palacios/vmm_direct_paging.c @@ -624,6 +624,7 @@ int v3_init_nested_paging(struct v3_vm_info *vm) { INIT_LIST_HEAD(&(vm->nested_impl.event_callback_list)); v3_rw_lock_init(&(vm->nested_impl.event_callback_lock)); + vm->nested_impl.inited=1; return 0; } @@ -644,6 +645,10 @@ int v3_deinit_nested_paging(struct v3_vm_info *vm) struct nested_event_callback *cb,*temp; addr_t flags; + if (!vm->nested_impl.inited) { + return 0; + } + flags=v3_write_lock_irqsave(&(vm->nested_impl.event_callback_lock)); list_for_each_entry_safe(cb,