diff options
Diffstat (limited to 'drivers/kvm/kvm_main.c')
-rw-r--r-- | drivers/kvm/kvm_main.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/kvm/kvm_main.c b/drivers/kvm/kvm_main.c index eb3931ca680a..9b79d3451f6f 100644 --- a/drivers/kvm/kvm_main.c +++ b/drivers/kvm/kvm_main.c | |||
@@ -272,7 +272,9 @@ static void kvm_free_physmem(struct kvm *kvm) | |||
272 | 272 | ||
273 | static void kvm_free_vcpu(struct kvm_vcpu *vcpu) | 273 | static void kvm_free_vcpu(struct kvm_vcpu *vcpu) |
274 | { | 274 | { |
275 | vcpu_load(vcpu->kvm, vcpu_slot(vcpu)); | 275 | if (!vcpu_load(vcpu->kvm, vcpu_slot(vcpu))) |
276 | return; | ||
277 | |||
276 | kvm_mmu_destroy(vcpu); | 278 | kvm_mmu_destroy(vcpu); |
277 | vcpu_put(vcpu); | 279 | vcpu_put(vcpu); |
278 | kvm_arch_ops->vcpu_free(vcpu); | 280 | kvm_arch_ops->vcpu_free(vcpu); |