From: Avi Kivity Date: Sun, 3 May 2009 15:50:55 +0000 (+0300) Subject: KVM: Make EFER reads safe when EFER does not exist X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=e286e86e6d2042d67d09244aa0e05ffef75c9d54;p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.git KVM: Make EFER reads safe when EFER does not exist Some processors don't have EFER; don't oops if userspace wants us to read EFER when we check NX. Cc: stable@kernel.org Signed-off-by: Avi Kivity --- diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index 834a7bf25e48..49079a46687b 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c @@ -1121,9 +1121,9 @@ void kvm_arch_vcpu_put(struct kvm_vcpu *vcpu) static int is_efer_nx(void) { - u64 efer; + unsigned long long efer = 0; - rdmsrl(MSR_EFER, efer); + rdmsrl_safe(MSR_EFER, &efer); return efer & EFER_NX; }