aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2015-08-03 18:52:55 +0100
committerPeter Maydell <peter.maydell@linaro.org>2015-08-03 18:52:55 +0100
commit260425ab405ea76c44dd59744d05176d4f579a52 (patch)
tree8f12cfead43b2cfb69a6b881cce86e1e4512b3a3
parente95edefbd0559e1d0aa09549641b5d9af1f96fac (diff)
parent6cd387833d05e8ad31829d97e474dc420625aed9 (diff)
Merge remote-tracking branch 'remotes/sstabellini/tags/cve-2015-5166-tag' into staging
cve-2015-5166 # gpg: Signature made Mon 03 Aug 2015 15:27:44 BST using RSA key ID 70E1AE90 # gpg: Good signature from "Stefano Stabellini <stefano.stabellini@eu.citrix.com>" * remotes/sstabellini/tags/cve-2015-5166-tag: Fix release_drive on unplugged devices (pci_piix3_xen_ide_unplug) Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
-rw-r--r--hw/ide/piix.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/hw/ide/piix.c b/hw/ide/piix.c
index adb664957c..5a26c86a8a 100644
--- a/hw/ide/piix.c
+++ b/hw/ide/piix.c
@@ -169,6 +169,7 @@ int pci_piix3_xen_ide_unplug(DeviceState *dev)
PCIIDEState *pci_ide;
DriveInfo *di;
int i;
+ IDEDevice *idedev;
pci_ide = PCI_IDE(dev);
@@ -181,6 +182,12 @@ int pci_piix3_xen_ide_unplug(DeviceState *dev)
blk_detach_dev(blk, ds);
}
pci_ide->bus[di->bus].ifs[di->unit].blk = NULL;
+ if (!(i % 2)) {
+ idedev = pci_ide->bus[di->bus].master;
+ } else {
+ idedev = pci_ide->bus[di->bus].slave;
+ }
+ idedev->conf.blk = NULL;
blk_unref(blk);
}
}