[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-ppc] [PULL 18/37] PPC: Fix crash on spapr_tce_table_finalize()
From: |
Alexander Graf |
Subject: |
[Qemu-ppc] [PULL 18/37] PPC: Fix crash on spapr_tce_table_finalize() |
Date: |
Wed, 7 Jan 2015 16:20:29 +0100 |
From: David Gibson <address@hidden>
spapr_tce_table_finalize() can SEGV if the object was not previously
realized. In particular this can be triggered by running
qemu-system-ppc -device spapr-tce-table,?
The basic problem is that we have mismatched initialization versus
finalization: spapr_tce_table_finalize() is attempting to undo things that
are done in spapr_tce_table_realize(), not an instance_init function.
Therefore, replace spapr_tce_table_finalize() with
spapr_tce_table_unrealize().
Signed-off-by: David Gibson <address@hidden>
Cc: address@hidden
Signed-off-by: Alexander Graf <address@hidden>
---
hw/ppc/spapr_iommu.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/hw/ppc/spapr_iommu.c b/hw/ppc/spapr_iommu.c
index 6c91d8e..da47474 100644
--- a/hw/ppc/spapr_iommu.c
+++ b/hw/ppc/spapr_iommu.c
@@ -173,9 +173,9 @@ sPAPRTCETable *spapr_tce_new_table(DeviceState *owner,
uint32_t liobn,
return tcet;
}
-static void spapr_tce_table_finalize(Object *obj)
+static void spapr_tce_table_unrealize(DeviceState *dev, Error **errp)
{
- sPAPRTCETable *tcet = SPAPR_TCE_TABLE(obj);
+ sPAPRTCETable *tcet = SPAPR_TCE_TABLE(dev);
QLIST_REMOVE(tcet, list);
@@ -420,6 +420,7 @@ static void spapr_tce_table_class_init(ObjectClass *klass,
void *data)
DeviceClass *dc = DEVICE_CLASS(klass);
dc->init = spapr_tce_table_realize;
dc->reset = spapr_tce_reset;
+ dc->unrealize = spapr_tce_table_unrealize;
QLIST_INIT(&spapr_tce_tables);
@@ -435,7 +436,6 @@ static TypeInfo spapr_tce_table_info = {
.parent = TYPE_DEVICE,
.instance_size = sizeof(sPAPRTCETable),
.class_init = spapr_tce_table_class_init,
- .instance_finalize = spapr_tce_table_finalize,
};
static void register_types(void)
--
1.8.1.4
- [Qemu-ppc] [PULL 10/37] target-ppc: Eliminate set_fprf Argument From gen_compute_fprf, (continued)
- [Qemu-ppc] [PULL 10/37] target-ppc: Eliminate set_fprf Argument From gen_compute_fprf, Alexander Graf, 2015/01/07
- [Qemu-ppc] [PULL 30/37] target-ppc: Mark SR() and gen_sync_exception() as !CONFIG_USER_ONLY, Alexander Graf, 2015/01/07
- [Qemu-ppc] [PULL 01/37] PPC: e500: Move CCSR definition to params, Alexander Graf, 2015/01/07
- [Qemu-ppc] [PULL 33/37] hw/machine: added machine_usb wrapper, Alexander Graf, 2015/01/07
- [Qemu-ppc] [PULL 07/37] target-ppc: Fix Floating Point Move Instructions That Set CR1, Alexander Graf, 2015/01/07
- [Qemu-ppc] [PULL 16/37] device-tree: fix memory leak, Alexander Graf, 2015/01/07
- [Qemu-ppc] [PULL 11/37] target-ppc: Eliminate set_fprf Argument From helper_compute_fprf, Alexander Graf, 2015/01/07
- [Qemu-ppc] [PULL 25/37] target-ppc: Introduce tbegin, Alexander Graf, 2015/01/07
- [Qemu-ppc] [PULL 20/37] target-ppc: Introduce Instruction Type for Transactional Memory, Alexander Graf, 2015/01/07
- [Qemu-ppc] [PULL 21/37] target-ppc: Introduce Feature Flag for Transactional Memory, Alexander Graf, 2015/01/07
- [Qemu-ppc] [PULL 18/37] PPC: Fix crash on spapr_tce_table_finalize(),
Alexander Graf <=
- [Qemu-ppc] [PULL 32/37] hw/ppc: modified the condition for usb controllers to be created for some ppc machines, Alexander Graf, 2015/01/07
- [Qemu-ppc] [PULL 28/37] target-ppc: Introduce Privileged TM Noops, Alexander Graf, 2015/01/07
- [Qemu-ppc] [PULL 15/37] spapr: Fix stale HTAB during live migration (TCG), Alexander Graf, 2015/01/07
- [Qemu-ppc] [PULL 26/37] target-ppc: Introduce TM Noops, Alexander Graf, 2015/01/07
- [Qemu-ppc] [PULL 24/37] target-ppc: Introduce TEXASRU Bit Fields, Alexander Graf, 2015/01/07
- [Qemu-ppc] [PULL 34/37] hw/usb: simplified usb_enabled, Alexander Graf, 2015/01/07
- [Qemu-ppc] [PULL 36/37] hw/ppc/spapr: simplify usb controller creation logic, Alexander Graf, 2015/01/07
- [Qemu-ppc] [PULL 19/37] pseries: Update SLOF firmware image to 20141202, Alexander Graf, 2015/01/07
- Re: [Qemu-ppc] [PULL 00/37] ppc patch queue 2015-01-07, Peter Maydell, 2015/01/10