migrate_add_blocker() can fail (e.g. if migration is already in progress), in which case it returns a negative value and populates its errp argument with the reason.
The previous code ignored the return value. Pass &error_fatal so that on failure QEMU exits cleanly with an informative error message rather than continuing in an inconsistent state. Resolves: CID 1645470 Signed-off-by: Trieu Huynh <[email protected]> --- v2: - Pass &error_fatal instead of returning NULL: the plugin has no recovery path, QEMU should exit cleanly with an error message. (Peter Maydell, Pierrick Bouvier) - Remove manual error_free(migration_blocker) + migration_blocker = NULL: migrate_add_blocker() already does this on failure. (Peter Maydell) --- plugins/api-system.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/api-system.c b/plugins/api-system.c index 9a70b9caa6..fbf905cd63 100644 --- a/plugins/api-system.c +++ b/plugins/api-system.c @@ -108,7 +108,7 @@ const void *qemu_plugin_request_time_control(void) has_control = true; error_setg(&migration_blocker, "TCG plugin time control does not support migration"); - migrate_add_blocker(&migration_blocker, NULL); + migrate_add_blocker(&migration_blocker, &error_fatal); return &has_control; } return NULL; -- 2.43.0
