From 3d63da16fbcd05405efd5946000cdb45474a9bad Mon Sep 17 00:00:00 2001 From: Jia Lina Date: Fri, 26 Oct 2018 16:36:20 +0800 Subject: migration: avoid segmentfault when take a snapshot of a VM which being migrated During an active background migration, snapshot will trigger a segmentfault. As snapshot clears the "current_migration" struct and updates "to_dst_file" before it finds out that there is a migration task, Migration accesses the null pointer in "current_migration" struct and qemu crashes eventually. Signed-off-by: Jia Lina Signed-off-by: Chai Wen Signed-off-by: Zhang Yu Message-Id: <20181026083620.10172-1-jialina01@baidu.com> Reviewed-by: Dr. David Alan Gilbert Signed-off-by: Dr. David Alan Gilbert --- migration/migration.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'migration/migration.c') diff --git a/migration/migration.c b/migration/migration.c index 8b36e7f184..b261c1e4ce 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -742,7 +742,7 @@ MigrationParameters *qmp_query_migrate_parameters(Error **errp) * Return true if we're already in the middle of a migration * (i.e. any of the active or setup states) */ -static bool migration_is_setup_or_active(int state) +bool migration_is_setup_or_active(int state) { switch (state) { case MIGRATION_STATUS_ACTIVE: -- cgit v1.2.3-59-g8ed1b