Skip to content

Commit

Permalink
KVM: fix EFER read buffer overflow
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Roel Kluin authored and Avi Kivity committed Sep 10, 2009
1 parent 1f3ee61 commit 3a34a88
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions arch/x86/kvm/vmx.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 3a34a88

Please sign in to comment.