Skip to content

Commit

Permalink
KVM: VMX: Fix locking order in handle_invalid_guest_state
Browse files Browse the repository at this point in the history
Release and re-acquire preemption and IRQ lock in the same order as
vcpu_enter_guest does.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
  • Loading branch information
Jan Kiszka authored and Avi Kivity committed Aug 5, 2009
1 parent 025dbbf commit 34f0c1a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions arch/x86/kvm/vmx.c
Original file line number Diff line number Diff line change
Expand Up @@ -3157,8 +3157,8 @@ static void handle_invalid_guest_state(struct kvm_vcpu *vcpu,
struct vcpu_vmx *vmx = to_vmx(vcpu);
enum emulation_result err = EMULATE_DONE;

preempt_enable();
local_irq_enable();
preempt_enable();

while (!guest_state_valid(vcpu)) {
err = emulate_instruction(vcpu, kvm_run, 0, 0, 0);
Expand All @@ -3177,8 +3177,8 @@ static void handle_invalid_guest_state(struct kvm_vcpu *vcpu,
schedule();
}

local_irq_disable();
preempt_disable();
local_irq_disable();

vmx->invalid_state_emulation_result = err;
}
Expand Down

0 comments on commit 34f0c1a

Please sign in to comment.