All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH master/stable-1.0] pci: fix corrupted pci conf index register by unaligned write
@ 2012-01-04 14:28 Avi Kivity
  2012-01-04 14:47 ` Michael S. Tsirkin
  0 siblings, 1 reply; 10+ messages in thread
From: Avi Kivity @ 2012-01-04 14:28 UTC (permalink / raw)
  To: Michael S. Tsirkin, qemu-devel

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 <gson@gson.org>
Signed-off-by: Avi Kivity <avi@redhat.com>
---

 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

^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2012-01-08 12:54 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-01-04 14:28 [Qemu-devel] [PATCH master/stable-1.0] pci: fix corrupted pci conf index register by unaligned write Avi Kivity
2012-01-04 14:47 ` Michael S. Tsirkin
2012-01-04 15:34   ` Alexander Graf
2012-01-05 15:14   ` Stefan Weil
2012-01-08  9:17     ` Michael S. Tsirkin
2012-01-08 10:02       ` Avi Kivity
2012-01-08 10:12         ` Michael S. Tsirkin
2012-01-08 10:48           ` Avi Kivity
2012-01-08 12:45             ` Michael S. Tsirkin
2012-01-08 12:53               ` Avi Kivity

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.