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

Daniel P. Berrangé berrange at redhat.com
Fri Jul 26 16:13:25 UTC 2019


On Fri, Jul 26, 2019 at 11:51:46AM -0400, Stefan Berger wrote:
> 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 at linux.ibm.com>
> ---
>  src/qemu/qemu_security.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/src/qemu/qemu_security.c b/src/qemu/qemu_security.c
> index 87209d3781..3f0d19eba8 100644
> --- a/src/qemu/qemu_security.c
> +++ b/src/qemu/qemu_security.c
> @@ -475,8 +475,9 @@ qemuSecurityStartTPMEmulator(virQEMUDriverPtr driver,
>      }
>  
>      if (virSecurityManagerTransactionCommit(driver->securityManager,
> -                                            -1, priv->rememberOwner) < 0)
> -        goto cleanup;
> +                                            -1, priv->rememberOwner) < 0) {
> +        goto cleanup_abort;
> +    }
>      transactionStarted = false;
>  
>      if (virSecurityManagerSetChildProcessLabel(driver->securityManager,
> @@ -512,6 +513,7 @@ qemuSecurityStartTPMEmulator(virQEMUDriverPtr driver,
>                                              -1, priv->rememberOwner) < 0)
>          VIR_WARN("Unable to run security manager transaction");
>  
> + cleanup_abort:
>      virSecurityManagerTransactionAbort(driver->securityManager);
>      return ret;
>  }

Reviewed-by: Daniel P. Berrangé <berrange at redhat.com>

Regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|




More information about the libvir-list mailing list