KVM: Don't destroy vcpu in case vcpu_setup fails
authorGlauber Costa <glommer@redhat.com>
Thu, 18 Sep 2008 02:16:59 +0000 (23:16 -0300)
committerAvi Kivity <avi@redhat.com>
Wed, 15 Oct 2008 12:25:10 +0000 (14:25 +0200)
commit7d8fece678c1abc2ca3e1ceda2277c3538a9161c
tree4a41eaf5fd8f8d04fcc483197c67a448981fc0c8
parentaf2152f5457448bd90cb019c108e0a85e716fdbe
KVM: Don't destroy vcpu in case vcpu_setup fails

One of vcpu_setup responsibilities is to do mmu initialization.
However, in case we fail in kvm_arch_vcpu_reset, before we get the
chance to init mmu. OTOH, vcpu_destroy will attempt to destroy mmu,
triggering a bug. Keeping track of whether or not mmu is initialized
would unnecessarily complicate things. Rather, we just make return,
making sure any needed uninitialization is done before we return, in
case we fail.

Signed-off-by: Glauber Costa <glommer@redhat.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
virt/kvm/kvm_main.c