[libvirt] [PATCH] Allocate priv->vioserialaddrs unconditionally

Ján Tomko jtomko at redhat.com
Fri May 29 13:11:22 UTC 2015

When attempting to hotplug a virtio-serial console to a domain
that had no virtio-serial controllers (not even those that
are added by libvirt when some devices need them) at daemon startup,
report a user-friendly error:

error: Failed to attach device from console.xml
error: internal error: no virtio-serial controllers are available

instead of crashing the daemon:

Process terminating with default action of signal 11 (SIGSEGV): dumping core
 Access not within mapped region at address 0x8
   at 0x531028F: virDomainVirtioSerialAddrNext (domain_addr.c:916)
   by 0x531028F: virDomainVirtioSerialAddrAssign (domain_addr.c:1029)
   by 0x1CBF68: qemuDomainAttachChrDevice (qemu_hotplug.c:1565)
   by 0x1BCD5E: qemuDomainAttachDeviceLive (qemu_driver.c:7997)
   by 0x1BCD5E: qemuDomainAttachDeviceFlags (qemu_driver.c:8743)

Introduced in v1.2.14-30-g5903378.
 src/qemu/qemu_command.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index d8ce511..11c6823 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -1447,9 +1447,6 @@ qemuDomainAssignVirtioSerialAddresses(virDomainDefPtr def,
     virDomainVirtioSerialAddrSetPtr addrs = NULL;
     qemuDomainObjPrivatePtr priv = NULL;
-    if (virDomainControllerFindByType(def, VIR_DOMAIN_CONTROLLER_TYPE_VIRTIO_SERIAL) == -1)
-        return 0;
     if (!(addrs = virDomainVirtioSerialAddrSetCreate()))
         goto cleanup;

More information about the libvir-list mailing list