Re: [PATCH] efi_loader: Uninstall the TCG2 protocol if logging s-crtm fails

2021-05-11 Thread Heinrich Schuchardt

On 5/10/21 8:19 PM, Ilias Apalodimas wrote:

Instead of just failing, clean up the installed config table and
EventLog memory if logging an s-crtm event fails during the protocol
installation

Signed-off-by: Ilias Apalodimas 
---
  lib/efi_loader/efi_tcg2.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/efi_loader/efi_tcg2.c b/lib/efi_loader/efi_tcg2.c
index 570cc746ed4e..8f8a26e7b7ae 100644
--- a/lib/efi_loader/efi_tcg2.c
+++ b/lib/efi_loader/efi_tcg2.c
@@ -1113,7 +1113,7 @@ efi_status_t efi_tcg2_register(void)



When merging I will replace the only 'goto out;' above in this function
by 'return ret;' to get rid of the label.

Reviewed-by: Heinrich Schuchardt 


ret = efi_append_scrtm_version(dev);
if (ret != EFI_SUCCESS)
-   goto out;
+   goto fail;

ret = efi_add_protocol(efi_root, _guid_tcg2_protocol,
   (void *)_tcg2_protocol);





[PATCH] efi_loader: Uninstall the TCG2 protocol if logging s-crtm fails

2021-05-10 Thread Ilias Apalodimas
Instead of just failing, clean up the installed config table and
EventLog memory if logging an s-crtm event fails during the protocol
installation

Signed-off-by: Ilias Apalodimas 
---
 lib/efi_loader/efi_tcg2.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/efi_loader/efi_tcg2.c b/lib/efi_loader/efi_tcg2.c
index 570cc746ed4e..8f8a26e7b7ae 100644
--- a/lib/efi_loader/efi_tcg2.c
+++ b/lib/efi_loader/efi_tcg2.c
@@ -1113,7 +1113,7 @@ efi_status_t efi_tcg2_register(void)
 
ret = efi_append_scrtm_version(dev);
if (ret != EFI_SUCCESS)
-   goto out;
+   goto fail;
 
ret = efi_add_protocol(efi_root, _guid_tcg2_protocol,
   (void *)_tcg2_protocol);
-- 
2.31.0