From ded3cf4aaf7af98f56822566cd96f3014fe5508c Mon Sep 17 00:00:00 2001 From: Peter Xu Date: Tue, 21 Oct 2025 18:04:07 -0400 Subject: [PATCH] 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 --- migration/migration.c | 6 ++++++ 1 file changed, 6 insertions(+) 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)) { -- 2.47.3