From: Peter Xu Date: Tue, 21 Oct 2025 22:04:07 +0000 (-0400) Subject: migration/cpr: Avoid crashing QEMU when cpr-exec runs with no args X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=ded3cf4aaf7af98f56822566cd96f3014fe5508c;p=thirdparty%2Fqemu.git migration/cpr: Avoid crashing QEMU when cpr-exec runs with no args If an user invokes cpr-exec without setting the exec args first, currently it'll crash QEMU. Avoid it, instead fail the QMP migrate command. Reviewed-by: Fabiano Rosas Link: https://lore.kernel.org/r/20251021220407.2662288-5-peterx@redhat.com Signed-off-by: Peter Xu --- diff --git a/migration/migration.c b/migration/migration.c index c8a5712993..4ed2a2e881 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -2195,6 +2195,12 @@ static bool migrate_prepare(MigrationState *s, bool resume, Error **errp) error_setg(errp, "Cannot use %s with CPR", conflict); return false; } + + if (s->parameters.mode == MIG_MODE_CPR_EXEC && + !s->parameters.cpr_exec_command) { + error_setg(errp, "Parameter 'cpr-exec-command' required for cpr-exec"); + return false; + } } if (migrate_init(s, errp)) {