]> git.baikalelectronics.ru Git - kernel.git/commit
KVM: arm64: Don't write to Rt unless sys_reg emulation succeeds
authorOliver Upton <oupton@google.com>
Tue, 3 May 2022 06:02:00 +0000 (06:02 +0000)
committerMarc Zyngier <maz@kernel.org>
Tue, 3 May 2022 10:14:33 +0000 (11:14 +0100)
commite8c8c3f35837a98b1ec324de1653c37f420b8c9c
treee2b478c1412aa41a0149a68f6602f5303b2aedee
parent61b040cfdc9738d190295b530c771eebc01ef4fe
KVM: arm64: Don't write to Rt unless sys_reg emulation succeeds

emulate_sys_reg() returns 1 unconditionally, even though a a system
register access can fail. Furthermore, kvm_handle_sys_reg() writes to Rt
for every register read, regardless of if it actually succeeded.

Though this pattern is safe (as params.regval is initialized with the
current value of Rt) it is a bit ugly. Indicate failure if the register
access could not be emulated and only write to Rt on success.

Signed-off-by: Oliver Upton <oupton@google.com>
Signed-off-by: Marc Zyngier <maz@kernel.org>
Link: https://lore.kernel.org/r/20220503060205.2823727-3-oupton@google.com
arch/arm64/kvm/sys_regs.c