All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] efi: Fix ESRT refresh after Capsule update
@ 2021-04-19 13:54 Jose Marinho
  2021-04-19 19:05 ` Heinrich Schuchardt
  0 siblings, 1 reply; 2+ messages in thread
From: Jose Marinho @ 2021-04-19 13:54 UTC (permalink / raw)
  To: u-boot

Indicated by Coverity Scan CID 331147

The ESRT was being refreshed in situations where the UpdateCapsule
procedure failed. In that scenario:

1) the ESRT refresh was superfluous.
2) a failed ESRT refresh return code overwrites the UpdateCapsule error
return code.

This commit ensures that the ESRT is only refreshed when the
UpdateCapsule performs successfully.

CC: Heinrich Schuchardt <xypron.glpk@gmx.de>
CC: Sughosh Ganu <sughosh.ganu@linaro.org>
CC: AKASHI Takahiro <takahiro.akashi@linaro.org>
CC: Tom Rini <trini@konsulko.com>
CC: Andre Przywara <andre.przywara@arm.com>
CC: nd at arm.com

Signed-off-by: Jose Marinho <jose.marinho@arm.com>
---
 lib/efi_loader/efi_capsule.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/efi_loader/efi_capsule.c b/lib/efi_loader/efi_capsule.c
index 691eda5e0d..a984c347e1 100644
--- a/lib/efi_loader/efi_capsule.c
+++ b/lib/efi_loader/efi_capsule.c
@@ -481,7 +481,6 @@ efi_status_t EFIAPI efi_update_capsule(
 		if (ret != EFI_SUCCESS)
 			goto out;
 	}
-out:
 
 	if (IS_ENABLED(CONFIG_EFI_ESRT)) {
 		/* Rebuild the ESRT to reflect any updated FW images. */
@@ -489,6 +488,7 @@ out:
 		if (ret != EFI_SUCCESS)
 			log_warning("EFI Capsule: failed to update ESRT\n");
 	}
+out:
 
 	return EFI_EXIT(ret);
 }
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [PATCH] efi: Fix ESRT refresh after Capsule update
  2021-04-19 13:54 [PATCH] efi: Fix ESRT refresh after Capsule update Jose Marinho
@ 2021-04-19 19:05 ` Heinrich Schuchardt
  0 siblings, 0 replies; 2+ messages in thread
From: Heinrich Schuchardt @ 2021-04-19 19:05 UTC (permalink / raw)
  To: u-boot

On 4/19/21 3:54 PM, Jose Marinho wrote:
> Indicated by Coverity Scan CID 331147
>
> The ESRT was being refreshed in situations where the UpdateCapsule
> procedure failed. In that scenario:
>
> 1) the ESRT refresh was superfluous.
> 2) a failed ESRT refresh return code overwrites the UpdateCapsule error
> return code.
>
> This commit ensures that the ESRT is only refreshed when the
> UpdateCapsule performs successfully.
>
> CC: Heinrich Schuchardt <xypron.glpk@gmx.de>
> CC: Sughosh Ganu <sughosh.ganu@linaro.org>
> CC: AKASHI Takahiro <takahiro.akashi@linaro.org>
> CC: Tom Rini <trini@konsulko.com>
> CC: Andre Przywara <andre.przywara@arm.com>
> CC: nd at arm.com
>
> Signed-off-by: Jose Marinho <jose.marinho@arm.com>

Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

> ---
>   lib/efi_loader/efi_capsule.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/lib/efi_loader/efi_capsule.c b/lib/efi_loader/efi_capsule.c
> index 691eda5e0d..a984c347e1 100644
> --- a/lib/efi_loader/efi_capsule.c
> +++ b/lib/efi_loader/efi_capsule.c
> @@ -481,7 +481,6 @@ efi_status_t EFIAPI efi_update_capsule(
>   		if (ret != EFI_SUCCESS)
>   			goto out;
>   	}
> -out:
>
>   	if (IS_ENABLED(CONFIG_EFI_ESRT)) {
>   		/* Rebuild the ESRT to reflect any updated FW images. */
> @@ -489,6 +488,7 @@ out:
>   		if (ret != EFI_SUCCESS)
>   			log_warning("EFI Capsule: failed to update ESRT\n");
>   	}
> +out:
>
>   	return EFI_EXIT(ret);
>   }
>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-04-19 19:05 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-19 13:54 [PATCH] efi: Fix ESRT refresh after Capsule update Jose Marinho
2021-04-19 19:05 ` Heinrich Schuchardt

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.