]> xenbits.xensource.com Git - people/liuw/libxenctrl-split/libvirt.git/commitdiff
Allocate priv->vioserialaddrs unconditionally
authorJán Tomko <jtomko@redhat.com>
Fri, 29 May 2015 13:03:24 +0000 (15:03 +0200)
committerJán Tomko <jtomko@redhat.com>
Fri, 29 May 2015 13:26:25 +0000 (15:26 +0200)
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

index d8ce511d1cce1851442100dba62784e6f6ebae00..11c6823e846f79c02f657efba9696ce2d4c1c76e 100644 (file)
@@ -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;