KVM: Fix compound mmio
authorGleb Natapov <gleb@redhat.com>
Tue, 12 Apr 2011 09:36:24 +0000 (12:36 +0300)
committerAvi Kivity <avi@redhat.com>
Sun, 22 May 2011 12:39:52 +0000 (08:39 -0400)
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>
arch/x86/kvm/x86.c

index e3ac212f7c8738bd0c00a7e49504276449983c54..a9a307a754654ebd6079aa9da0180f227f7c32dd 100644 (file)
@@ -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;