]> git.ipfire.org Git - thirdparty/libvirt.git/commit
qemu: Do not crash when canceling migration on reconnect
authorJiri Denemark <jdenemar@redhat.com>
Wed, 12 Oct 2022 15:45:38 +0000 (17:45 +0200)
committerJiri Denemark <jdenemar@redhat.com>
Mon, 24 Oct 2022 13:28:47 +0000 (15:28 +0200)
commit1a570f97125dbf4897e48c833b8fcec0ddbc13f1
treeb6e5c4bbe281e5bf119b0bbb518a2f49ddbf1dfe
parent4dd86f334bc3c9679865176f588597cf99375330
qemu: Do not crash when canceling migration on reconnect

When libvirtd is restarted during an active outgoing migration (or
snapshot, save, or dump which are internally implemented as migration)
it wants to cancel the migration. But by a mistake in commit
v8.7.0-57-g2d7b22b561 the qemuMigrationSrcCancel function is called with
wait == true, which leads to an instant crash by dereferencing NULL
pointer stored in priv->job.current.

When canceling migration to file (snapshot, save, dump), we don't need
to wait until it is really canceled as no migration capabilities or
parameters need to be restored.

On the other hand we need to wait when canceling outgoing migration and
since we don't have virDomainJobData at this point, we have to
temporarily restore the migration job to make sure we can process
MIGRATION events from QEMU.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
src/qemu/qemu_migration.c
src/qemu/qemu_migration.h
src/qemu/qemu_process.c