]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/commitdiff
KVM: fix EFER read buffer overflow
authorRoel Kluin <roel.kluin@gmail.com>
Tue, 4 Aug 2009 09:08:45 +0000 (02:08 -0700)
committerAvi Kivity <avi@redhat.com>
Thu, 10 Sep 2009 05:33:21 +0000 (08:33 +0300)
Check whether index is within bounds before grabbing the element.

Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
Cc: Avi Kivity <avi@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Avi Kivity <avi@redhat.com>
arch/x86/kvm/vmx.c

index 0ba706e87c50a2cc5bfd01e7502d89ce2a51972f..31c3a8740c4204bfd6852d34525872e9d3570761 100644 (file)
@@ -571,12 +571,15 @@ static void reload_tss(void)
 static void load_transition_efer(struct vcpu_vmx *vmx)
 {
        int efer_offset = vmx->msr_offset_efer;
-       u64 host_efer = vmx->host_msrs[efer_offset].data;
-       u64 guest_efer = vmx->guest_msrs[efer_offset].data;
+       u64 host_efer;
+       u64 guest_efer;
        u64 ignore_bits;
 
        if (efer_offset < 0)
                return;
+       host_efer = vmx->host_msrs[efer_offset].data;
+       guest_efer = vmx->guest_msrs[efer_offset].data;
+
        /*
         * NX is emulated; LMA and LME handled by hardware; SCE meaninless
         * outside long mode