404507
From e41b2f83ca98fe352e9901d99b5cb9bf62d79845 Mon Sep 17 00:00:00 2001
404507
Message-Id: <e41b2f83ca98fe352e9901d99b5cb9bf62d79845@dist-git>
23265d
From: Jiri Denemark <jdenemar@redhat.com>
404507
Date: Fri, 19 Jan 2018 14:33:16 +0100
23265d
Subject: [PATCH] qemu: Fix crash in offline migration
23265d
23265d
When migrating a shutoff domain (i.e., offline migration), we have no
23265d
statistics to report and thus jobInfo will be NULL in
23265d
qemuMigrationFinish.
23265d
23265d
Broken by me in v3.10.0-183-ge8784e7868.
23265d
23265d
https://bugzilla.redhat.com/show_bug.cgi?id=1536351
23265d
23265d
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
23265d
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
23265d
(cherry picked from commit bcc5710708ec90146b71bdb00d8705cb4a9e0088)
23265d
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
23265d
---
23265d
 src/qemu/qemu_migration.c | 6 ++++--
23265d
 1 file changed, 4 insertions(+), 2 deletions(-)
23265d
23265d
diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
404507
index b814cc6608..a50bb7206c 100644
23265d
--- a/src/qemu/qemu_migration.c
23265d
+++ b/src/qemu/qemu_migration.c
404507
@@ -5459,8 +5459,10 @@ qemuMigrationFinish(virQEMUDriverPtr driver,
23265d
     }
23265d
 
23265d
     if (dom) {
23265d
-        VIR_STEAL_PTR(priv->job.completed, jobInfo);
23265d
-        priv->job.completed->status = QEMU_DOMAIN_JOB_STATUS_COMPLETED;
23265d
+        if (jobInfo) {
23265d
+            VIR_STEAL_PTR(priv->job.completed, jobInfo);
23265d
+            priv->job.completed->status = QEMU_DOMAIN_JOB_STATUS_COMPLETED;
23265d
+        }
23265d
 
23265d
         if (qemuMigrationBakeCookie(mig, driver, vm, cookieout, cookieoutlen,
23265d
                                     QEMU_MIGRATION_COOKIE_STATS) < 0)
23265d
-- 
404507
2.16.1
23265d