Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3a34a881 authored by Roel Kluin's avatar Roel Kluin Committed by Avi Kivity
Browse files

KVM: fix EFER read buffer overflow



Check whether index is within bounds before grabbing the element.

Signed-off-by: default avatarRoel Kluin <roel.kluin@gmail.com>
Cc: Avi Kivity <avi@redhat.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarAvi Kivity <avi@redhat.com>
parent 1f3ee616
Loading
Loading
Loading
Loading
+5 −2
Original line number Diff line number Diff line
@@ -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