x86/HVM: add missing NULL check before using VMFUNC hook
authorJan Beulich <jbeulich@suse.com>
Wed, 21 Dec 2016 15:47:19 +0000 (16:47 +0100)
committerJan Beulich <jbeulich@suse.com>
Wed, 21 Dec 2016 15:47:19 +0000 (16:47 +0100)
This is CVE-2016-10025 / XSA-203.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
xen/arch/x86/hvm/emulate.c

index 9da7336ce6f53e1251d64351893106bfcfb620e9..ecc107bc0a3ab86de84635b6806ff8843f85aabf 100644 (file)
@@ -1650,6 +1650,8 @@ static int hvmemul_vmfunc(
 {
     int rc;
 
+    if ( !hvm_funcs.altp2m_vcpu_emulate_vmfunc )
+        return X86EMUL_UNHANDLEABLE;
     rc = hvm_funcs.altp2m_vcpu_emulate_vmfunc(ctxt->regs);
     if ( rc != X86EMUL_OKAY )
         x86_emul_hw_exception(TRAP_invalid_op, X86_EVENT_NO_EC, ctxt);