]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
qemu_hotplug: Set correct iommufdState on error path
authorPavel Hrdina <phrdina@redhat.com>
Tue, 31 Mar 2026 11:24:28 +0000 (13:24 +0200)
committerPavel Hrdina <phrdina@redhat.com>
Tue, 31 Mar 2026 12:11:40 +0000 (14:11 +0200)
If hotplugging host device that needs to add iommufd object fails we
need to remove the iommufd object as well. We also need to update the
iommufdState otherwise hotplugging any host device with iommufd will
fail for the same VM.

Fixes: 5d16bef1a69500791be454239e3b9ac68ec53ace
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
src/qemu/qemu_hotplug.c

index c86ebc59d066048fc5e742870f179004d11e9f98..9439948089a04635c42af9fd1ca3b3851aa3770f 100644 (file)
@@ -1679,8 +1679,10 @@ qemuDomainAttachHostPCIDevice(virQEMUDriver *driver,
     if (virHostdevIsPCIDeviceWithIOMMUFD(hostdev)) {
         qemuDomainObjEnterMonitor(vm);
 
-        if (removeiommufd)
+        if (removeiommufd) {
+            priv->iommufdState = false;
             ignore_value(qemuMonitorDelObject(priv->mon, "iommufd0", false));
+        }
 
         qemuFDPassDirectTransferMonitorRollback(hostdevPriv->vfioDeviceFd, priv->mon);
         qemuFDPassDirectTransferMonitorRollback(priv->iommufd, priv->mon);