[libvirt] [PATCH v2 1/2] tpm: Set transationStarted to false if commit failed

Stefan Berger posted 2 patches 6 years, 6 months ago
[libvirt] [PATCH v2 1/2] tpm: Set transationStarted to false if commit failed
Posted by Stefan Berger 6 years, 6 months ago
Set the transactionStarted to false if the commit failed. If this is not
done, then the failure path will report 'no transaction is set' and hide
more useful error reports.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
---
 src/qemu/qemu_security.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/qemu/qemu_security.c b/src/qemu/qemu_security.c
index 87209d3781..3cd6d9bd3d 100644
--- a/src/qemu/qemu_security.c
+++ b/src/qemu/qemu_security.c
@@ -476,7 +476,7 @@ qemuSecurityStartTPMEmulator(virQEMUDriverPtr driver,
 
     if (virSecurityManagerTransactionCommit(driver->securityManager,
                                             -1, priv->rememberOwner) < 0)
-        goto cleanup;
+        goto cleanup_abort;
     transactionStarted = false;
 
     if (virSecurityManagerSetChildProcessLabel(driver->securityManager,
@@ -512,6 +512,7 @@ qemuSecurityStartTPMEmulator(virQEMUDriverPtr driver,
                                             -1, priv->rememberOwner) < 0)
         VIR_WARN("Unable to run security manager transaction");
 
+ cleanup_abort:
     virSecurityManagerTransactionAbort(driver->securityManager);
     return ret;
 }
-- 
2.21.0

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list