From 122dd9575c7a3b503e8f4aec64d16e8986a0bb91 Mon Sep 17 00:00:00 2001 From: Jan Beulich Date: Wed, 23 Nov 2016 15:27:47 +0100 Subject: [PATCH] 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 --- xen/arch/x86/x86_emulate/x86_emulate.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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); } -- 2.39.5