]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
Fix crash on usb-serial hotplug
authorJán Tomko <jtomko@redhat.com>
Fri, 21 Oct 2016 12:23:54 +0000 (14:23 +0200)
committerCole Robinson <crobinso@redhat.com>
Wed, 10 May 2017 19:42:45 +0000 (15:42 -0400)
For domains with no USB address cache, we should not attempt
to generate a USB address.

https://bugzilla.redhat.com/show_bug.cgi?id=1387665
(cherry picked from commit 00c5386c8622514553c41041312acf0ea86278d7)

src/qemu/qemu_hotplug.c

index d67dd926ac03d043428d3fe3f2a9d997caa6917e..2132bbf084205e0ed7aae138e13c62ef40fbdc8e 100644 (file)
@@ -1608,7 +1608,8 @@ qemuDomainAttachChrDeviceAssignAddr(virDomainDefPtr def,
             goto cleanup;
         ret = 1;
 
-    } else if (chr->deviceType == VIR_DOMAIN_CHR_DEVICE_TYPE_SERIAL &&
+    } else if (priv->usbaddrs &&
+               chr->deviceType == VIR_DOMAIN_CHR_DEVICE_TYPE_SERIAL &&
                chr->targetType == VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_USB) {
         if (virDomainUSBAddressEnsure(priv->usbaddrs, &chr->info) < 0)
             goto cleanup;