From: Gleb Natapov <gleb@redhat.com>
Date: Tue, 12 Apr 2011 09:36:24 +0000 (+0300)
Subject: KVM: Fix compound mmio
X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=0004c7c25757f103ddb3a9e4bcfd533aad41f9a0;p=GitHub%2Fexynos8895%2Fandroid_kernel_samsung_universal8895.git

KVM: Fix compound mmio

mmio_index should be taken into account when copying data from
userspace.

Signed-off-by: Gleb Natapov <gleb@redhat.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
---

diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index e3ac212f7c87..a9a307a75465 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -5576,7 +5576,8 @@ static int complete_mmio(struct kvm_vcpu *vcpu)
 	if (vcpu->mmio_needed) {
 		vcpu->mmio_needed = 0;
 		if (!vcpu->mmio_is_write)
-			memcpy(vcpu->mmio_data, run->mmio.data, 8);
+			memcpy(vcpu->mmio_data + vcpu->mmio_index,
+			       run->mmio.data, 8);
 		vcpu->mmio_index += 8;
 		if (vcpu->mmio_index < vcpu->mmio_size) {
 			run->exit_reason = KVM_EXIT_MMIO;