]> xenbits.xensource.com Git - libvirt.git/commitdiff
qemuDomainAttachDeviceDiskLiveInternal: Fix jumps on error
authorPeter Krempa <pkrempa@redhat.com>
Tue, 21 Nov 2023 16:17:38 +0000 (17:17 +0100)
committerPeter Krempa <pkrempa@redhat.com>
Thu, 23 Nov 2023 13:31:05 +0000 (14:31 +0100)
When I've originally refactored the function in commit 0d981bcefcb5defa2
the logic was still correct, but then later in commit 52f865543920b0
I've moved most of the image setup logic into the function neglecting to
add the 'goto cleanup;' needed to skip over the setup of the disk
images.

Fixes: 52f865543920b0cc5ba93f4407c1b2efdffb8ddc
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
src/qemu/qemu_hotplug.c

index fec7c4be4e8b6afbeb928fe1d8cc66b66433c27f..2d55d1d21e037382130532742d0d52b91610d3fd 100644 (file)
@@ -931,7 +931,7 @@ qemuDomainAttachDeviceDiskLiveInternal(virQEMUDriver *driver,
         if (disk->device == VIR_DOMAIN_DISK_DEVICE_LUN) {
             virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
                            _("disk device='lun' is not supported for usb bus"));
-            break;
+            goto cleanup;
         }
 
         if (virDomainUSBAddressEnsure(priv->usbaddrs, &disk->info) < 0)
@@ -991,6 +991,7 @@ qemuDomainAttachDeviceDiskLiveInternal(virQEMUDriver *driver,
         virReportError(VIR_ERR_OPERATION_UNSUPPORTED,
                        _("disk bus '%1$s' cannot be hotplugged."),
                        virDomainDiskBusTypeToString(disk->bus));
+        goto cleanup;
     }
 
     if (qemuDomainStorageSourceChainAccessAllow(driver, vm, disk->src) < 0)