4cd28d
From e3e7aa7c8ad6d687b9605b0da3b46ad0ef171157 Mon Sep 17 00:00:00 2001
4cd28d
Message-Id: <e3e7aa7c8ad6d687b9605b0da3b46ad0ef171157@dist-git>
4cd28d
From: Jiri Denemark <jdenemar@redhat.com>
4cd28d
Date: Tue, 19 Dec 2017 08:36:49 +0100
4cd28d
Subject: [PATCH] qemu: Properly store microcode version in QEMU caps cache
4cd28d
4cd28d
This fixes a misplaced hunk in the backport of "qemu: capabilities:
4cd28d
force update if the microcode version does not match". We need to make
4cd28d
sure the microcode version is assigned to QEMU caps object before the
4cd28d
caps get stored on a disk. Otherwise QEMU caps cached on a disk would
4cd28d
always be considered invalid when libvirtd starts and tries to load
4cd28d
them.
4cd28d
4cd28d
CVE-2017-5715
4cd28d
4cd28d
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
4cd28d
---
4cd28d
 src/qemu/qemu_capabilities.c | 6 +++---
4cd28d
 1 file changed, 3 insertions(+), 3 deletions(-)
4cd28d
4cd28d
diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
4cd28d
index 504e2c9587..8f9b1493a5 100644
4cd28d
--- a/src/qemu/qemu_capabilities.c
4cd28d
+++ b/src/qemu/qemu_capabilities.c
4cd28d
@@ -5210,6 +5210,9 @@ virQEMUCapsNewForBinaryInternal(virCapsPtr caps,
4cd28d
             goto error;
4cd28d
         }
4cd28d
 
4cd28d
+        if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_KVM))
4cd28d
+            qemuCaps->microcodeVersion = microcodeVersion;
4cd28d
+
4cd28d
         if (cacheDir &&
4cd28d
             virQEMUCapsRememberCached(qemuCaps, cacheDir) < 0)
4cd28d
             goto error;
4cd28d
@@ -5218,9 +5221,6 @@ virQEMUCapsNewForBinaryInternal(virCapsPtr caps,
4cd28d
         virQEMUCapsInitHostCPUModel(qemuCaps, caps, VIR_DOMAIN_VIRT_QEMU);
4cd28d
     }
4cd28d
 
4cd28d
-    if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_KVM))
4cd28d
-        qemuCaps->microcodeVersion = microcodeVersion;
4cd28d
-
4cd28d
  cleanup:
4cd28d
     VIR_FREE(qmperr);
4cd28d
     return qemuCaps;
4cd28d
-- 
4cd28d
2.15.1
4cd28d