]> git.proxmox.com Git - mirror_qemu.git/commitdiff
migration: process_incoming_migration_co(): fix reporting s->error
authorVladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>
Tue, 30 Apr 2024 08:56:44 +0000 (11:56 +0300)
committerFabiano Rosas <farosas@suse.de>
Wed, 8 May 2024 12:20:57 +0000 (09:20 -0300)
It's bad idea to leave critical section with error object freed, but
s->error still set, this theoretically may lead to use-after-free
crash. Let's avoid it.

Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>
Reviewed-by: Fabiano Rosas <farosas@suse.de>
Reviewed-by: Peter Xu <peterx@redhat.com>
Signed-off-by: Fabiano Rosas <farosas@suse.de>
migration/migration.c

index 0d26db47f72ca8ca5292bbf0e2bbe71da3fe1a82..b307a4bc5932c9c53e206c565a7846da3a6a08f5 100644 (file)
@@ -784,6 +784,7 @@ process_incoming_migration_co(void *opaque)
         if (migrate_has_error(s)) {
             WITH_QEMU_LOCK_GUARD(&s->error_mutex) {
                 error_report_err(s->error);
+                s->error = NULL;
             }
         }
         error_report("load of migration failed: %s", strerror(-ret));