[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 23/28] bus: do not unref hotplug handler
From: |
Marc-André Lureau |
Subject: |
[Qemu-devel] [PULL 23/28] bus: do not unref hotplug handler |
Date: |
Wed, 1 Mar 2017 13:04:48 +0400 |
Apparently, none of the bus owner give a reference to the hotplug
handler property, do not unref it on bus release.
Furthermore, a bus is allowed to be its own hotplug handler, which can
be seen in qbus_set_bus_hotplug_handler() function. However, in this
case, the reference can't be given to the property, or this will create
a cyclic dependency and the bus will never be free.
Each bus owner should manage the lifecycle of the hotplug handler.
Signed-off-by: Marc-André Lureau <address@hidden>
Reviewed-by: Paolo Bonzini <address@hidden>
---
hw/acpi/piix4.c | 2 ++
hw/core/bus.c | 2 +-
2 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/hw/acpi/piix4.c b/hw/acpi/piix4.c
index 6d99fe407c..a553a7e110 100644
--- a/hw/acpi/piix4.c
+++ b/hw/acpi/piix4.c
@@ -440,6 +440,8 @@ static void piix4_update_bus_hotplug(PCIBus *pci_bus, void
*opaque)
{
PIIX4PMState *s = opaque;
+ /* pci_bus cannot outlive PIIX4PMState, because /machine keeps it alive
+ * and it's not hot-unpluggable */
qbus_set_hotplug_handler(BUS(pci_bus), DEVICE(s), &error_abort);
}
diff --git a/hw/core/bus.c b/hw/core/bus.c
index cf383fc1af..4651f24486 100644
--- a/hw/core/bus.c
+++ b/hw/core/bus.c
@@ -197,7 +197,7 @@ static void qbus_initfn(Object *obj)
TYPE_HOTPLUG_HANDLER,
(Object **)&bus->hotplug_handler,
object_property_allow_set_link,
- OBJ_PROP_LINK_UNREF_ON_RELEASE,
+ 0,
NULL);
object_property_add_bool(obj, "realized",
bus_get_realized, bus_set_realized, NULL);
--
2.12.0.rc2.3.gc93709801
- [Qemu-devel] [PULL 13/28] tests: fix ipmi-kcs-test leak, (continued)
- [Qemu-devel] [PULL 13/28] tests: fix ipmi-kcs-test leak, Marc-André Lureau, 2017/03/01
- [Qemu-devel] [PULL 14/28] tests: fix ipmi-bt-test leak, Marc-André Lureau, 2017/03/01
- [Qemu-devel] [PULL 15/28] pc: pcihp: avoid adding ACPI_PCIHP_PROP_BSEL twice, Marc-André Lureau, 2017/03/01
- [Qemu-devel] [PULL 16/28] tests: fix eepro100-test leak, Marc-André Lureau, 2017/03/01
- [Qemu-devel] [PULL 18/28] tests: fix e1000-test leak, Marc-André Lureau, 2017/03/01
- [Qemu-devel] [PULL 17/28] tests: fix tco-test leaks, Marc-André Lureau, 2017/03/01
- [Qemu-devel] [PULL 19/28] tests: fix i440fx-test leaks, Marc-André Lureau, 2017/03/01
- [Qemu-devel] [PULL 20/28] tests: fix e1000e leaks, Marc-André Lureau, 2017/03/01
- [Qemu-devel] [PULL 21/28] tests: fix virtio-scsi-test leak, Marc-André Lureau, 2017/03/01
- [Qemu-devel] [PULL 22/28] tests: fix virtio-9p-test leaks, Marc-André Lureau, 2017/03/01
- [Qemu-devel] [PULL 23/28] bus: do not unref hotplug handler,
Marc-André Lureau <=
- [Qemu-devel] [PULL 24/28] usb: release the created buses, Marc-André Lureau, 2017/03/01
- [Qemu-devel] [PULL 25/28] tests: allows to run single test in usb-hcd-ehci-test, Marc-André Lureau, 2017/03/01
- [Qemu-devel] [PULL 26/28] tests: fix usb-test leaks, Marc-André Lureau, 2017/03/01
- [Qemu-devel] [PULL 27/28] tests: add specialized device_find function, Marc-André Lureau, 2017/03/01
- [Qemu-devel] [PULL 28/28] tests: fix virtio-blk-test leaks, Marc-André Lureau, 2017/03/01
- Re: [Qemu-devel] [PULL 00/28] Leak patches, Peter Maydell, 2017/03/02