migration: Assign current_migration as NULL after migration
PATCH 1/1 migration: Assign current_migration as NULL after migration
In migration_shutdown, global var current_migration is freed but not assigned to NULL, which may cause heap-use-after-free problem if the following code logic is abnormal.
Signed-off-by Keqian Zhu <[email protected]>
--- migration/migration.c | 1 + 1 file changed, 1 insertion(+)
migration/migration.c +1 -0
@@ -189,6 +189,7 @@ void migration_shutdown(void)*/ migrate_fd_cancel (current_migration);object_unref (OBJECT (current_migration)); + current_migration =NULL ; }/* For outgoing */
Signature · 1 line
2.19.1
Please ignore this patch :-)
If we shutdown VM during migration, the migration thread may still ref current_migration at this point.
Quoted 22 lines · Keqian Zhu
In
migration_shutdown, global varcurrent_migrationis freed but not assigned to NULL, which may cause heap-use-after-free problem if the following code logic is abnormal.Signed-off-by Keqian Zhu <[email protected]>--- migration/migration.c | 1 + 1 file changed, 1 insertion(+)migration/migration.c +1
-0@@ -189,6 +189,7 @@ void migration_shutdown(void)*/ migrate_fd_cancel (current_migration);object_unref (OBJECT (current_migration)); + current_migration =NULL ; }/* For outgoing */