From: Eric Auger Date: Fri, 25 Sep 2015 21:41:16 +0000 (+0200) Subject: KVM: arm/arm64: check power_off in critical section before VCPU run X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=101d3da09c953b08c814cd9a0b8605623d640ba0;p=linux-beck.git KVM: arm/arm64: check power_off in critical section before VCPU run In case a vcpu off PSCI call is called just after we executed the vcpu_sleep check, we can enter the guest although power_off is set. Let's check the power_off state in the critical section, just before entering the guest. Signed-off-by: Eric Auger Reported-by: Christoffer Dall Reviewed-by: Christoffer Dall Signed-off-by: Christoffer Dall --- diff --git a/arch/arm/kvm/arm.c b/arch/arm/kvm/arm.c index d04deeb1d4e0..3b3384c37e24 100644 --- a/arch/arm/kvm/arm.c +++ b/arch/arm/kvm/arm.c @@ -560,7 +560,8 @@ int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu, struct kvm_run *run) run->exit_reason = KVM_EXIT_INTR; } - if (ret <= 0 || need_new_vmid_gen(vcpu->kvm)) { + if (ret <= 0 || need_new_vmid_gen(vcpu->kvm) || + vcpu->arch.power_off) { local_irq_enable(); kvm_timer_sync_hwstate(vcpu); kvm_vgic_sync_hwstate(vcpu);