|
|
99cbc7 |
From 51be47223840c917b0a98782c214d6b8e031b658 Mon Sep 17 00:00:00 2001
|
|
|
99cbc7 |
Message-Id: <51be47223840c917b0a98782c214d6b8e031b658@dist-git>
|
|
|
99cbc7 |
From: Jiri Denemark <jdenemar@redhat.com>
|
|
|
99cbc7 |
Date: Thu, 2 Aug 2018 16:56:02 +0200
|
|
|
99cbc7 |
Subject: [PATCH] qemu_migration: Avoid writing to freed memory
|
|
|
99cbc7 |
MIME-Version: 1.0
|
|
|
99cbc7 |
Content-Type: text/plain; charset=UTF-8
|
|
|
99cbc7 |
Content-Transfer-Encoding: 8bit
|
|
|
99cbc7 |
|
|
|
99cbc7 |
When a domain is killed on the source host while it is being migrated
|
|
|
99cbc7 |
and libvirtd is waiting for the migration to finish (waiting for the
|
|
|
99cbc7 |
domain condition in qemuMigrationSrcWaitForCompletion), the run-time
|
|
|
99cbc7 |
state including priv->job.current may already be freed once
|
|
|
99cbc7 |
virDomainObjWait returns with -1. Thus the priv->job.current pointer
|
|
|
99cbc7 |
cached in jobInfo is no longer valid and setting jobInfo->status may
|
|
|
99cbc7 |
crash the daemon.
|
|
|
99cbc7 |
|
|
|
99cbc7 |
https://bugzilla.redhat.com/show_bug.cgi?id=1593137
|
|
|
99cbc7 |
|
|
|
99cbc7 |
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
|
|
|
99cbc7 |
Reviewed-by: Ján Tomko <jtomko@redhat.com>
|
|
|
99cbc7 |
(cherry picked from commit dddcb601ebf97ef222a03bb27b2357e831e8a0cc)
|
|
|
99cbc7 |
|
|
|
99cbc7 |
https://bugzilla.redhat.com/show_bug.cgi?id=1615854
|
|
|
99cbc7 |
|
|
|
99cbc7 |
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
|
|
|
99cbc7 |
Reviewed-by: Erik Skultety <eskultet@redhat.com>
|
|
|
99cbc7 |
---
|
|
|
99cbc7 |
src/qemu/qemu_migration.c | 3 ++-
|
|
|
99cbc7 |
1 file changed, 2 insertions(+), 1 deletion(-)
|
|
|
99cbc7 |
|
|
|
99cbc7 |
diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
|
|
|
99cbc7 |
index 435cd174af..825a9d399b 100644
|
|
|
99cbc7 |
--- a/src/qemu/qemu_migration.c
|
|
|
99cbc7 |
+++ b/src/qemu/qemu_migration.c
|
|
|
99cbc7 |
@@ -1584,7 +1584,8 @@ qemuMigrationSrcWaitForCompletion(virQEMUDriverPtr driver,
|
|
|
99cbc7 |
|
|
|
99cbc7 |
if (events) {
|
|
|
99cbc7 |
if (virDomainObjWait(vm) < 0) {
|
|
|
99cbc7 |
- jobInfo->status = QEMU_DOMAIN_JOB_STATUS_FAILED;
|
|
|
99cbc7 |
+ if (virDomainObjIsActive(vm))
|
|
|
99cbc7 |
+ jobInfo->status = QEMU_DOMAIN_JOB_STATUS_FAILED;
|
|
|
99cbc7 |
return -2;
|
|
|
99cbc7 |
}
|
|
|
99cbc7 |
} else {
|
|
|
99cbc7 |
--
|
|
|
99cbc7 |
2.18.0
|
|
|
99cbc7 |
|