From 9183dd15334f1eee46051bbdafc6ab9fbfc2efd5 Mon Sep 17 00:00:00 2001 From: Vladimir Sementsov-Ogievskiy Date: Thu, 24 Jan 2019 15:25:24 +0300 Subject: [PATCH] qmp: forbid qmp_cont in RUN_STATE_FINISH_MIGRATE qmp_cont in RUN_STATE_FINISH_MIGRATE may lead to moving vm to RUN_STATE_RUNNING, before actual migration finish. So, when migration thread will try to go to RUN_STATE_POSTMIGRATE, assuming transition RUN_STATE_FINISH_MIGRATE->RUN_STATE_POSTMIGRATE, it will crash, as current state is RUN_STATE_RUNNING, and transition RUN_STATE_RUNNING->RUN_STATE_POSTMIGRATE is forbidden. Reported-by: Max Reitz Signed-off-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Dr. David Alan Gilbert Signed-off-by: Kevin Wolf --- qmp.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/qmp.c b/qmp.c index b92d62cd5f..fa1b3c1577 100644 --- a/qmp.c +++ b/qmp.c @@ -156,6 +156,9 @@ void qmp_cont(Error **errp) return; } else if (runstate_check(RUN_STATE_SUSPENDED)) { return; + } else if (runstate_check(RUN_STATE_FINISH_MIGRATE)) { + error_setg(errp, "Migration is not finalized yet"); + return; } for (blk = blk_next(NULL); blk; blk = blk_next(blk)) {