Received: from eggs.gnu.org ([140.186.70.92]:59081) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RiRq0-0003us-HF for qemu-devel@nongnu.org; Wed, 04 Jan 2012 09:29:12 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RiRpz-0004Us-51 for qemu-devel@nongnu.org; Wed, 04 Jan 2012 09:29:08 -0500 Received: from mx1.redhat.com ([209.132.183.28]:19054) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RiRpy-0004UZ-UC for qemu-devel@nongnu.org; Wed, 04 Jan 2012 09:29:07 -0500 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q04ET5g7001146 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Wed, 4 Jan 2012 09:29:05 -0500 Received: from cleopatra.tlv.redhat.com (cleopatra.tlv.redhat.com [10.35.255.11]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id q04ET4SV009723 for ; Wed, 4 Jan 2012 09:29:05 -0500 From: Avi Kivity Date: Wed, 4 Jan 2012 16:28:42 +0200 Message-Id: <1325687322-6797-1-git-send-email-avi@redhat.com> Subject: [Qemu-devel] [PATCH master/stable-1.0] pci: fix corrupted pci conf index register by unaligned write List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Michael S. Tsirkin" , qemu-devel@nongnu.org Commit d0ed8076cbdc261 converted the PCI config access to the memory API, but also inadvertantly changed it to accept unaligned writes, and corrupt the index register in the process. This causes a regression booting NetBSD. Fix by ignoring unaligned or non-dword writes. https://bugs.launchpad.net/qemu/+bug/897771 Reported-by: Andreas Gustafsson Signed-off-by: Avi Kivity --- hw/pci_host.c | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-) diff --git a/hw/pci_host.c b/hw/pci_host.c index 44c6c20..8041778 100644 --- a/hw/pci_host.c +++ b/hw/pci_host.c @@ -101,6 +101,9 @@ static void pci_host_config_write(void *opaque, target_phys_addr_t addr, PCI_DPRINTF("%s addr " TARGET_FMT_plx " len %d val %"PRIx64"\n", __func__, addr, len, val); + if (addr != 0 || len != 4) { + return; + } s->config_reg = val; } -- 1.7.7.1