diff options
author | Greg Kurz <groug@kaod.org> | 2019-10-24 16:27:33 +0200 |
---|---|---|
committer | Laurent Vivier <lvivier@redhat.com> | 2019-11-18 11:50:25 +0100 |
commit | 0a83b47055246d3942084f03fc54731c4fb9b731 (patch) | |
tree | 15a0f96fe9cac621b126b962c1f8c5ea7089e225 /hw/intc/xics.c | |
parent | 35886de140b7ff781b775d2da5e7475e8a8cb4c6 (diff) |
ppc: Skip partially initialized vCPUs in 'info pic'
CPU_FOREACH() can race with vCPU hotplug/unplug on sPAPR machines, ie.
we may try to print out info about a vCPU with a NULL presenter pointer.
Check that in order to prevent QEMU from crashing.
Signed-off-by: Greg Kurz <groug@kaod.org>
Message-Id: <157192725327.3146912.12047076483178652551.stgit@bahia.lan>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Laurent Vivier <lvivier@redhat.com>
Diffstat (limited to 'hw/intc/xics.c')
-rw-r--r-- | hw/intc/xics.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/hw/intc/xics.c b/hw/intc/xics.c index 5f746079be..e7ac9ba618 100644 --- a/hw/intc/xics.c +++ b/hw/intc/xics.c @@ -44,7 +44,16 @@ void icp_pic_print_info(ICPState *icp, Monitor *mon) { - int cpu_index = icp->cs ? icp->cs->cpu_index : -1; + int cpu_index; + + /* Skip partially initialized vCPUs. This can happen on sPAPR when vCPUs + * are hot plugged or unplugged. + */ + if (!icp) { + return; + } + + cpu_index = icp->cs ? icp->cs->cpu_index : -1; if (!icp->output) { return; |