Skip to contentSkip to conversation

KVM: VMX: Fix locking imbalance on emulation failure

PATCH Applied Jan Kiszka 2 participants 2 messages Jul 21, 2009

Subsystems (3)
lore
Share & tools
lore

Jan Kiszka

author
#0 lore raw

PATCH 1/1 KVM: VMX: Fix locking imbalance on emulation failure

We have to disable preemption and IRQs on every exit from handle_invalid_guest_state, otherwise we generate at least a preempt_disable imbalance.

---

 arch/x86/kvm/vmx.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
arch/x86/kvm/vmx.c +1 -1
index 3a75db3..7a8d464 100644
@@ -3335,7 +3335,7 @@ static void handle_invalid_guest_state(struct kvm_vcpu *vcpu,
 
 		if (err != EMULATE_DONE) {
 			kvm_report_emulation_failure(vcpu, "emulation failure");
-			return;
+			break;
 		}
 
 		if (signal_pending(current))
#1 lore raw
Quoted 15 lines · Jan Kiszka

We have to disable preemption and IRQs on every exit from handle_invalid_guest_state, otherwise we generate at least a preempt_disable imbalance.

---

 arch/x86/kvm/vmx.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
arch/x86/kvm/vmx.c +0 -0
index 3a75db3..7a8d464 100644

arch/x86/kvm/vmx.c static void handle_invalid_guest_state(struct kvm_vcpu *vcpu, · line 3341

Quoted 8 lines
arch/x86/kvm/vmx.c +1 -1
@@ -3335,7 +3335,7 @@ static void handle_invalid_guest_state(struct kvm_vcpu *vcpu,
 
 		if (err != EMULATE_DONE) {
 			kvm_report_emulation_failure(vcpu, "emulation failure");
-			return;
+			break;
 		}
 
 		if (signal_pending(current))

Applied, thanks.