]> git.baikalelectronics.ru Git - kernel.git/commit
kvm: call kvm_arch_destroy_vm if vm creation fails
authorJim Mattson <jmattson@google.com>
Fri, 25 Oct 2019 11:34:58 +0000 (13:34 +0200)
committerPaolo Bonzini <pbonzini@redhat.com>
Thu, 31 Oct 2019 11:13:16 +0000 (12:13 +0100)
commit93d61f363d779362943fd14db02f3b38b18bcf54
tree1832cc63a277b8af0ce0d7c254aaf7042f86bbb9
parent4fdf90f97626233bef851b1b6fe6bc6e0190869a
kvm: call kvm_arch_destroy_vm if vm creation fails

In kvm_create_vm(), if we've successfully called kvm_arch_init_vm(), but
then fail later in the function, we need to call kvm_arch_destroy_vm()
so that it can do any necessary cleanup (like freeing memory).

Fixes: b09f7780cbb061 ("KVM: x86: Detect and Initialize AVIC support")
Signed-off-by: John Sperbeck <jsperbeck@google.com>
Signed-off-by: Jim Mattson <jmattson@google.com>
Reviewed-by: Junaid Shahid <junaids@google.com>
[Remove dependency on "kvm: Don't clear reference count on
 kvm_create_vm() error path" which was not committed. - Paolo]
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
virt/kvm/kvm_main.c