From: Zhenzhong Duan Date: Mon, 23 Jun 2025 10:22:33 +0000 (+0800) Subject: vfio/container: fails mdev hotplug if add migration blocker failed X-Git-Tag: v10.1.0-rc0~40^2~19 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=c72d6ebaadcaec1daa995d47716348e150757a51;p=thirdparty%2Fqemu.git vfio/container: fails mdev hotplug if add migration blocker failed It's aggressive to abort a running QEMU process when hotplug a mdev and it fails migration blocker adding. Fix by just failing mdev hotplug itself. Signed-off-by: Zhenzhong Duan Reviewed-by: Cédric Le Goater Link: https://lore.kernel.org/qemu-devel/20250623102235.94877-3-zhenzhong.duan@intel.com [ clg: Changed test on value returned by migrate_add_blocker_modes() ] Signed-off-by: Cédric Le Goater --- diff --git a/hw/vfio/container.c b/hw/vfio/container.c index 2853f6f08b5..3e13feaa74c 100644 --- a/hw/vfio/container.c +++ b/hw/vfio/container.c @@ -992,12 +992,16 @@ static bool vfio_legacy_attach_device(const char *name, VFIODevice *vbasedev, if (vbasedev->mdev) { error_setg(&vbasedev->cpr.mdev_blocker, "CPR does not support vfio mdev %s", vbasedev->name); - migrate_add_blocker_modes(&vbasedev->cpr.mdev_blocker, &error_fatal, - MIG_MODE_CPR_TRANSFER, -1); + if (migrate_add_blocker_modes(&vbasedev->cpr.mdev_blocker, errp, + MIG_MODE_CPR_TRANSFER, -1) < 0) { + goto hiod_unref_exit; + } } return true; +hiod_unref_exit: + object_unref(vbasedev->hiod); device_put_exit: vfio_device_put(vbasedev); group_put_exit: