Skip to content

Commit a189884

Browse files
reijiw-kvmMarc Zyngier
authored andcommitted
KVM: arm64: Have kvm_psci_vcpu_on() use WRITE_ONCE() to update mp_state
All accessors of kvm_vcpu_arch::mp_state should be {READ,WRITE}_ONCE(), since readers of the mp_state don't acquire the mp_state_lock. Nonetheless, kvm_psci_vcpu_on() updates the mp_state without using WRITE_ONCE(). So, fix the code to update the mp_state using WRITE_ONCE. Signed-off-by: Reiji Watanabe <reijiw@google.com> Signed-off-by: Marc Zyngier <maz@kernel.org> Link: https://lore.kernel.org/r/20230419021852.2981107-3-reijiw@google.com
1 parent 4ff910b commit a189884

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

arch/arm64/kvm/psci.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ static unsigned long kvm_psci_vcpu_on(struct kvm_vcpu *source_vcpu)
110110
*/
111111
smp_wmb();
112112

113-
vcpu->arch.mp_state.mp_state = KVM_MP_STATE_RUNNABLE;
113+
WRITE_ONCE(vcpu->arch.mp_state.mp_state, KVM_MP_STATE_RUNNABLE);
114114
kvm_vcpu_wake_up(vcpu);
115115

116116
out_unlock:

0 commit comments

Comments
 (0)