1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2025-01-09 01:18:00 +03:00

qemuAssignDeviceChrAlias: Fix a crasher during <console/> hotplug

For a running guest, a <serial/> device can be hotunplugged. This
will then remove also aliased <console/>. Trying to hotplug a
<console/> device then, libvirtd crashed because it dereferences
def->consoles while there's none.

Fixes: 42d53ac799
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
Michal Privoznik 2023-04-12 12:20:42 +02:00
parent e99072731c
commit fc8320faef

View File

@ -95,6 +95,7 @@ qemuAssignDeviceChrAlias(virDomainDef *def,
if (chr->deviceType == VIR_DOMAIN_CHR_DEVICE_TYPE_CONSOLE &&
chr->targetType == VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_SERIAL &&
def->os.type == VIR_DOMAIN_OSTYPE_HVM &&
def->nconsoles &&
def->consoles[0] == chr &&
def->nserials &&
def->serials[0]->info.alias) {