Commit 34f0c1ad authored by Jan Kiszka's avatar Jan Kiszka Committed by Avi Kivity

KVM: VMX: Fix locking order in handle_invalid_guest_state

Release and re-acquire preemption and IRQ lock in the same order as
vcpu_enter_guest does.
Signed-off-by: default avatarJan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: default avatarMarcelo Tosatti <mtosatti@redhat.com>
Signed-off-by: default avatarAvi Kivity <avi@redhat.com>
parent 025dbbf3
...@@ -3157,8 +3157,8 @@ static void handle_invalid_guest_state(struct kvm_vcpu *vcpu, ...@@ -3157,8 +3157,8 @@ static void handle_invalid_guest_state(struct kvm_vcpu *vcpu,
struct vcpu_vmx *vmx = to_vmx(vcpu); struct vcpu_vmx *vmx = to_vmx(vcpu);
enum emulation_result err = EMULATE_DONE; enum emulation_result err = EMULATE_DONE;
preempt_enable();
local_irq_enable(); local_irq_enable();
preempt_enable();
while (!guest_state_valid(vcpu)) { while (!guest_state_valid(vcpu)) {
err = emulate_instruction(vcpu, kvm_run, 0, 0, 0); err = emulate_instruction(vcpu, kvm_run, 0, 0, 0);
...@@ -3177,8 +3177,8 @@ static void handle_invalid_guest_state(struct kvm_vcpu *vcpu, ...@@ -3177,8 +3177,8 @@ static void handle_invalid_guest_state(struct kvm_vcpu *vcpu,
schedule(); schedule();
} }
local_irq_disable();
preempt_disable(); preempt_disable();
local_irq_disable();
vmx->invalid_state_emulation_result = err; vmx->invalid_state_emulation_result = err;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment