[PATCH 3/5] qemuAssignDeviceChrAlias: Fix a crasher during <console/> hotplug

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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: 42d53ac799a1d7f1414737caa4deb73871876992
Signed-off-by: Michal Privoznik <mprivozn@xxxxxxxxxx>
---
 src/qemu/qemu_alias.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/qemu/qemu_alias.c b/src/qemu/qemu_alias.c
index 85db7fbfe3..161d30cf72 100644
--- a/src/qemu/qemu_alias.c
+++ b/src/qemu/qemu_alias.c
@@ -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) {
-- 
2.39.2




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux