From: Pavel Hrdina Date: Tue, 31 Mar 2026 11:24:28 +0000 (+0200) Subject: qemu_hotplug: Set correct iommufdState on error path X-Git-Tag: v12.2.0~6 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2f8013287a3ff369edcdcd9ff29702594d0ffd99;p=thirdparty%2Flibvirt.git qemu_hotplug: Set correct iommufdState on error path 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 Reviewed-by: Peter Krempa --- diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c index c86ebc59d0..9439948089 100644 --- a/src/qemu/qemu_hotplug.c +++ b/src/qemu/qemu_hotplug.c @@ -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);