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-Tag: v2.6.29.4~8 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=21616cb7a37a63b9f33ea2e45ab6d29910b43fd2;p=thirdparty%2Fkernel%2Fstable.git KVM: Make EFER reads safe when EFER does not exist commit e286e86e6d2042d67d09244aa0e05ffef75c9d54 upstream. Some processors don't have EFER; don't oops if userspace wants us to read EFER when we check NX. Signed-off-by: Avi Kivity Signed-off-by: Greg Kroah-Hartman --- diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index 425423eff489d..92f0457ebe58b 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c @@ -1075,9 +1075,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; }