Skip to contentSkip to conversation

efi: Fix ESRT refresh after Capsule update

PATCH New Jose Marinho 2 participants 2 messages Apr 19, 2021

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 efi: Fix ESRT refresh after Capsule update

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 <[email protected]>
CC Sughosh Ganu <[email protected]>
CC AKASHI Takahiro <[email protected]>
CC Tom Rini <[email protected]>
CC Andre Przywara <[email protected]>
CC nd at arm.com
---
 lib/efi_loader/efi_capsule.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
lib/efi_loader/efi_capsule.c +1 -1
index 691eda5e0d..a984c347e1 100644
@@ -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);
 }
Signature · 1 line
2.17.1
#1 lore raw

PATCH 1/1 efi: Fix ESRT refresh after Capsule update

Quoted 12 lines · Jose Marinho

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.

Quoted 8 lines
CC Heinrich Schuchardt <[email protected]>
CC Sughosh Ganu <[email protected]>
CC AKASHI Takahiro <[email protected]>
CC Tom Rini <[email protected]>
CC Andre Przywara <[email protected]>
CC nd at arm.com
Quoted 25 lines
---
  lib/efi_loader/efi_capsule.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
lib/efi_loader/efi_capsule.c +1 -1
index 691eda5e0d..a984c347e1 100644
@@ -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);
  }