From: Jan Beulich Date: Wed, 23 Nov 2016 14:27:47 +0000 (+0100) Subject: x86emul: in_longmode() should not ignore ->read_msr() errors X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~73 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=122dd9575c7a3b503e8f4aec64d16e8986a0bb91;p=xen.git x86emul: in_longmode() should not ignore ->read_msr() errors All present hook implementations succeed for EFER, but we shouldn't really build on this being the case. Suggested-by: George Dunlap Signed-off-by: Jan Beulich Reviewed-by: Andrew Cooper Release-acked-by: Wei Liu --- diff --git a/xen/arch/x86/x86_emulate/x86_emulate.c b/xen/arch/x86/x86_emulate/x86_emulate.c index a85f45e2bb..04f0dac572 100644 --- a/xen/arch/x86/x86_emulate/x86_emulate.c +++ b/xen/arch/x86/x86_emulate/x86_emulate.c @@ -1296,10 +1296,10 @@ in_longmode( { uint64_t efer; - if (ops->read_msr == NULL) + if ( !ops->read_msr || + unlikely(ops->read_msr(MSR_EFER, &efer, ctxt) != X86EMUL_OKAY) ) return -1; - ops->read_msr(MSR_EFER, &efer, ctxt); return !!(efer & EFER_LMA); }