]> git.proxmox.com Git - mirror_qemu.git/commit
xive, xics: Fix reference counting on CPU objects
authorGreg Kurz <groug@kaod.org>
Thu, 24 Oct 2019 14:27:27 +0000 (16:27 +0200)
committerLaurent Vivier <lvivier@redhat.com>
Mon, 18 Nov 2019 10:50:16 +0000 (11:50 +0100)
commit35886de140b7ff781b775d2da5e7475e8a8cb4c6
tree4c1b3625f85ecacd3b81a906e55084f754b2d1ad
parent0990ce6a2e900d0bdda7f3ecdc991746f63551fb
xive, xics: Fix reference counting on CPU objects

When a VCPU gets connected to the XIVE interrupt controller, we add a
const link targetting the CPU object to the TCTX object. Similar links
are added to the ICP object when using the XICS interrupt controller.

As explained in <qom/object.h>:

 * The caller must ensure that @target stays alive as long as
 * this property exists.  In the case @target is a child of @obj,
 * this will be the case.  Otherwise, the caller is responsible for
 * taking a reference.

We're in the latter case for both XICS and XIVE. Add the missing
calls to object_ref() and object_unref().

This doesn't fix any known issue because the life cycle of the TCTX or
ICP happens to be shorter than the one of the CPU or XICS fabric, but
better safe than sorry.

Signed-off-by: Greg Kurz <groug@kaod.org>
Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
Message-Id: <157192724770.3146912.15400869269097231255.stgit@bahia.lan>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Laurent Vivier <lvivier@redhat.com>
hw/intc/xics.c
hw/intc/xive.c