]> xenbits.xensource.com Git - libvirt.git/commitdiff
qemu: sev: Don't jump to endjob if SEV measurement retrieval fails
authorErik Skultety <eskultet@redhat.com>
Mon, 18 Jun 2018 07:20:13 +0000 (09:20 +0200)
committerErik Skultety <eskultet@redhat.com>
Wed, 20 Jun 2018 06:07:24 +0000 (08:07 +0200)
If measurement retrieval fails we'd forget to call ExitMonitor to unlock
the monitor.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
Reported-by: Luyao Huang <lhuang@redhat.com>
Reviewed-by: Marc Hartmayer <mhartmay@linux.ibm.com>
src/qemu/qemu_driver.c

index 0c790c14bb49cee820f94cf3dbde59ce3266c43e..66125f25f6e48950b9f1ec3d9adda2e9b38e858f 100644 (file)
@@ -21520,12 +21520,13 @@ qemuDomainGetSEVMeasurement(virQEMUDriverPtr driver,
 
     qemuDomainObjEnterMonitor(driver, vm);
     tmp = qemuMonitorGetSEVMeasurement(QEMU_DOMAIN_PRIVATE(vm)->mon);
-    if (tmp == NULL)
-        goto endjob;
 
     if (qemuDomainObjExitMonitor(driver, vm) < 0)
         goto endjob;
 
+    if (!tmp)
+        goto endjob;
+
     if (virTypedParamsAddString(params, nparams, &maxpar,
                                 VIR_DOMAIN_LAUNCH_SECURITY_SEV_MEASUREMENT,
                                 tmp) < 0)