diff options
author | Roman Kagan <rkagan@virtuozzo.com> | 2018-11-26 15:28:44 +0000 |
---|---|---|
committer | Eduardo Habkost <ehabkost@redhat.com> | 2018-11-26 14:14:38 -0200 |
commit | 30a759b61a9247378a9cb84fbe4e437ae66e0461 (patch) | |
tree | 223c558ddddc4cf211267dd522a0e63207e1e828 /hw/hyperv | |
parent | aec5e9c3a94cf8b7920f59bef69a6f426092c4a0 (diff) | |
download | qemu-30a759b61a9247378a9cb84fbe4e437ae66e0461.zip qemu-30a759b61a9247378a9cb84fbe4e437ae66e0461.tar.gz qemu-30a759b61a9247378a9cb84fbe4e437ae66e0461.tar.bz2 |
hw/hyperv: fix NULL dereference with pure-kvm SynIC
When started in compat configuration of SynIC, e.g.
qemu-system-x86_64 -machine pc-i440fx-2.10,accel=kvm \
-cpu host,-vmx,hv-relaxed,hv_spinlocks=0x1fff,hv-vpindex,hv-synic
or explicitly
qemu-system-x86_64 -enable-kvm -cpu host,hv-synic,x-hv-synic-kvm-only=on
QEMU crashes in hyperv_synic_reset() trying to access the non-present
qobject for SynIC.
Add the missing check for NULL.
Reported-by: Vitaly Kuznetsov <vkuznets@redhat.com>
Reported-by: Igor Mammedov <imammedo@redhat.com>
Fixes: 9b4cf107b09d18ac30f46fd1c4de8585ccba030c
Fixes: 4a93722f9c279184e95b1e1ad775c01deec05065
Signed-off-by: Roman Kagan <rkagan@virtuozzo.com>
Message-Id: <20181126152836.25379-1-rkagan@virtuozzo.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Tested-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Diffstat (limited to 'hw/hyperv')
-rw-r--r-- | hw/hyperv/hyperv.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/hw/hyperv/hyperv.c b/hw/hyperv/hyperv.c index a28e724..8758635 100644 --- a/hw/hyperv/hyperv.c +++ b/hw/hyperv/hyperv.c @@ -136,7 +136,11 @@ void hyperv_synic_add(CPUState *cs) void hyperv_synic_reset(CPUState *cs) { - device_reset(DEVICE(get_synic(cs))); + SynICState *synic = get_synic(cs); + + if (synic) { + device_reset(DEVICE(synic)); + } } static const TypeInfo synic_type_info = { |