From patchwork Tue Apr 12 09:36:24 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gleb Natapov X-Patchwork-Id: 699591 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id p3C9aaWb000415 for ; Tue, 12 Apr 2011 09:36:37 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756876Ab1DLJgf (ORCPT ); Tue, 12 Apr 2011 05:36:35 -0400 Received: from mx1.redhat.com ([209.132.183.28]:53019 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756880Ab1DLJg3 (ORCPT ); Tue, 12 Apr 2011 05:36:29 -0400 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p3C9aRu0020573 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Tue, 12 Apr 2011 05:36:27 -0400 Received: from dhcp-1-237.tlv.redhat.com (dhcp-1-237.tlv.redhat.com [10.35.1.237]) by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id p3C9aQRP024821; Tue, 12 Apr 2011 05:36:27 -0400 Received: by dhcp-1-237.tlv.redhat.com (Postfix, from userid 13519) id B07DE18D3EC; Tue, 12 Apr 2011 12:36:25 +0300 (IDT) From: Gleb Natapov To: kvm@vger.kernel.org Cc: avi@redhat.com, mtosatti@redhat.com Subject: [PATCH 4/5] KVM: Fix compound mmio. Date: Tue, 12 Apr 2011 12:36:24 +0300 Message-Id: <1302600985-10704-4-git-send-email-gleb@redhat.com> In-Reply-To: <1302600985-10704-1-git-send-email-gleb@redhat.com> References: <1302600985-10704-1-git-send-email-gleb@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.25 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Tue, 12 Apr 2011 09:36:37 +0000 (UTC) mmio_index should be taken into account when copying data from userspace. Signed-off-by: Gleb Natapov --- arch/x86/kvm/x86.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index b568779..609c7ab 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c @@ -5518,7 +5518,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;