diff mbox series

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

Message ID 20210510181915.233918-1-ilias.apalodimas@linaro.org
State New
Headers show
Series efi_loader: Uninstall the TCG2 protocol if logging s-crtm fails | expand

Commit Message

Ilias Apalodimas May 10, 2021, 6:19 p.m. UTC
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 <ilias.apalodimas@linaro.org>

---
 lib/efi_loader/efi_tcg2.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

-- 
2.31.0

Comments

Heinrich Schuchardt May 11, 2021, 6:33 a.m. UTC | #1
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 <ilias.apalodimas@linaro.org>

> ---

>   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 <xypron.glpk@gmx.de>


>   	ret = efi_append_scrtm_version(dev);

>   	if (ret != EFI_SUCCESS)

> -		goto out;

> +		goto fail;

>

>   	ret = efi_add_protocol(efi_root, &efi_guid_tcg2_protocol,

>   			       (void *)&efi_tcg2_protocol);

>
diff mbox series

Patch

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, &efi_guid_tcg2_protocol,
 			       (void *)&efi_tcg2_protocol);