]> xenbits.xensource.com Git - xen.git/commitdiff
x86emul: in_longmode() should not ignore ->read_msr() errors
authorJan Beulich <jbeulich@suse.com>
Wed, 23 Nov 2016 14:27:47 +0000 (15:27 +0100)
committerJan Beulich <jbeulich@suse.com>
Wed, 23 Nov 2016 14:27:47 +0000 (15:27 +0100)
All present hook implementations succeed for EFER, but we shouldn't
really build on this being the case.

Suggested-by: George Dunlap <george.dunlap@citrix.com>
Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
Release-acked-by: Wei Liu <wei.liu2@citrix.com>
xen/arch/x86/x86_emulate/x86_emulate.c

index a85f45e2bbcdd5ae0b0f262f09a588a4e87e1b79..04f0dac572277bd8e51e0c2224fa4020293b4a96 100644 (file)
@@ -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);
 }