summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGleb Natapov <gleb@redhat.com>2013-01-21 15:36:48 +0200
committerMarcelo Tosatti <mtosatti@redhat.com>2013-01-24 00:40:31 -0200
commit378a8b099fc207ddcb91b19a8c1457667e0af398 (patch)
tree765795d3fb0e37b87ba5b37d119b2731809ec64b
parent91b0aa2ca63e60ac69c5dd96bff580d3947073d4 (diff)
downloadlinux-3.10-378a8b099fc207ddcb91b19a8c1457667e0af398.tar.gz
linux-3.10-378a8b099fc207ddcb91b19a8c1457667e0af398.tar.bz2
linux-3.10-378a8b099fc207ddcb91b19a8c1457667e0af398.zip
KVM: x86: fix use of uninitialized memory as segment descriptor in emulator.
If VMX reports segment as unusable, zero descriptor passed by the emulator before returning. Such descriptor will be considered not present by the emulator. Signed-off-by: Gleb Natapov <gleb@redhat.com> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
-rw-r--r--arch/x86/kvm/x86.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index e00dd0515a8..b9f55299ed7 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -4489,8 +4489,10 @@ static bool emulator_get_segment(struct x86_emulate_ctxt *ctxt, u16 *selector,
kvm_get_segment(emul_to_vcpu(ctxt), &var, seg);
*selector = var.selector;
- if (var.unusable)
+ if (var.unusable) {
+ memset(desc, 0, sizeof(*desc));
return false;
+ }
if (var.g)
var.limit >>= 12;