]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
kvm: arm/arm64: Force reading uncached stage2 PGD
authorSuzuki K Poulose <suzuki.poulose@arm.com>
Tue, 16 May 2017 09:34:54 +0000 (10:34 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 25 May 2017 13:46:27 +0000 (15:46 +0200)
commit 2952a6070e07ebdd5896f1f5b861acad677caded upstream.

Make sure we don't use a cached value of the KVM stage2 PGD while
resetting the PGD.

Cc: Marc Zyngier <marc.zyngier@arm.com>
Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
Reviewed-by: Christoffer Dall <cdall@linaro.org>
Signed-off-by: Christoffer Dall <cdall@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
arch/arm/kvm/mmu.c

index 9624b193ce1e4493143af27e7edc7f3633ed5c20..3837b096e1a6661e4611f596d324f2576ebba19d 100644 (file)
@@ -844,7 +844,7 @@ void kvm_free_stage2_pgd(struct kvm *kvm)
        spin_lock(&kvm->mmu_lock);
        if (kvm->arch.pgd) {
                unmap_stage2_range(kvm, 0, KVM_PHYS_SIZE);
-               pgd = kvm->arch.pgd;
+               pgd = READ_ONCE(kvm->arch.pgd);
                kvm->arch.pgd = NULL;
        }
        spin_unlock(&kvm->mmu_lock);