]> xenbits.xensource.com Git - qemu-xen-4.3-testing.git/commitdiff
passthrough: Fix no_wb not to crash on unknown registers
authorIan Jackson <ian.jackson@eu.citrix.com>
Mon, 7 Dec 2009 12:25:54 +0000 (12:25 +0000)
committerIan Jackson <Ian.Jackson@eu.citrix.com>
Mon, 7 Dec 2009 12:25:54 +0000 (12:25 +0000)
e2b98415256cb264bc25e6df539ec0dc9d1b85b0 broke things sometimes:

 If pt_find_reg_grp() fails and returns NULL, it will jump to out:,
 but at this time reg is still NULL (pt_find_reg() is not reached)
 which leads to a NULL dereference.

This patch fixes it.

Submitted-By: Qing He <qing.he@intel.com>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
hw/pass-through.c

index b125d7222e16cadd24fbc8b4db66ea594e1ed569..e7bd38602a4ad1bf084e3655e535ef4288f1cbe5 100644 (file)
@@ -1556,7 +1556,7 @@ static void pt_pci_write_config(PCIDevice *d, uint32_t address, uint32_t val,
     val >>= ((address & 3) << 3);
 
 out:
-    if (!reg->no_wb) {
+    if (!(reg && reg->no_wb)) {  /* unknown regs are passed through */
         ret = pci_write_block(pci_dev, address, (uint8_t *)&val, len);
 
         if (!ret)