diff options
author | Marc Zyngier <maz@kernel.org> | 2021-08-20 11:57:10 +0100 |
---|---|---|
committer | Marc Zyngier <maz@kernel.org> | 2021-08-20 11:57:10 +0100 |
commit | fb1c16c0aea805500ea62f007a92ea10945e3b63 (patch) | |
tree | ef3240eb57aa41266879b16dba1e68fb49b83634 /arch/arm64/kvm/arm.c | |
parent | ccac96977243d7916053550f62e6489760ad0adc (diff) | |
parent | c4d7c51845af9542d42cd18a25c570583abf2768 (diff) | |
download | linux-fb1c16c0aea805500ea62f007a92ea10945e3b63.tar.gz linux-fb1c16c0aea805500ea62f007a92ea10945e3b63.tar.bz2 linux-fb1c16c0aea805500ea62f007a92ea10945e3b63.zip |
Merge tag 'kvmarm-fixes-5.14-2' into kvm-arm64/mmu/el2-tracking
KVM/arm64 fixes for 5.14, take #2
- Plug race between enabling MTE and creating vcpus
- Fix off-by-one bug when checking whether an address range is RAM
Signed-off-by: Marc Zyngier <maz@kernel.org>
Diffstat (limited to 'arch/arm64/kvm/arm.c')
-rw-r--r-- | arch/arm64/kvm/arm.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/arch/arm64/kvm/arm.c b/arch/arm64/kvm/arm.c index 2f378482471b..37f738877aa3 100644 --- a/arch/arm64/kvm/arm.c +++ b/arch/arm64/kvm/arm.c @@ -94,10 +94,14 @@ int kvm_vm_ioctl_enable_cap(struct kvm *kvm, kvm->arch.return_nisv_io_abort_to_user = true; break; case KVM_CAP_ARM_MTE: - if (!system_supports_mte() || kvm->created_vcpus) - return -EINVAL; - r = 0; - kvm->arch.mte_enabled = true; + mutex_lock(&kvm->lock); + if (!system_supports_mte() || kvm->created_vcpus) { + r = -EINVAL; + } else { + r = 0; + kvm->arch.mte_enabled = true; + } + mutex_unlock(&kvm->lock); break; default: r = -EINVAL; |