aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--virt/kvm/kvm_main.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
index 13cefe226e44..fce0578eab0e 100644
--- a/virt/kvm/kvm_main.c
+++ b/virt/kvm/kvm_main.c
@@ -401,23 +401,19 @@ static struct kvm *kvm_create_vm(void)
401 r = -ENOMEM; 401 r = -ENOMEM;
402 kvm->memslots = kzalloc(sizeof(struct kvm_memslots), GFP_KERNEL); 402 kvm->memslots = kzalloc(sizeof(struct kvm_memslots), GFP_KERNEL);
403 if (!kvm->memslots) 403 if (!kvm->memslots)
404 goto out_err; 404 goto out_err_nosrcu;
405 if (init_srcu_struct(&kvm->srcu)) 405 if (init_srcu_struct(&kvm->srcu))
406 goto out_err; 406 goto out_err_nosrcu;
407 for (i = 0; i < KVM_NR_BUSES; i++) { 407 for (i = 0; i < KVM_NR_BUSES; i++) {
408 kvm->buses[i] = kzalloc(sizeof(struct kvm_io_bus), 408 kvm->buses[i] = kzalloc(sizeof(struct kvm_io_bus),
409 GFP_KERNEL); 409 GFP_KERNEL);
410 if (!kvm->buses[i]) { 410 if (!kvm->buses[i])
411 cleanup_srcu_struct(&kvm->srcu);
412 goto out_err; 411 goto out_err;
413 }
414 } 412 }
415 413
416 r = kvm_init_mmu_notifier(kvm); 414 r = kvm_init_mmu_notifier(kvm);
417 if (r) { 415 if (r)
418 cleanup_srcu_struct(&kvm->srcu);
419 goto out_err; 416 goto out_err;
420 }
421 417
422 kvm->mm = current->mm; 418 kvm->mm = current->mm;
423 atomic_inc(&kvm->mm->mm_count); 419 atomic_inc(&kvm->mm->mm_count);
@@ -435,6 +431,8 @@ out:
435 return kvm; 431 return kvm;
436 432
437out_err: 433out_err:
434 cleanup_srcu_struct(&kvm->srcu);
435out_err_nosrcu:
438 hardware_disable_all(); 436 hardware_disable_all();
439out_err_nodisable: 437out_err_nodisable:
440 for (i = 0; i < KVM_NR_BUSES; i++) 438 for (i = 0; i < KVM_NR_BUSES; i++)