public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH 1/1] SignedCapsulePkg: Add handling of NULL returned from FMP Descriptor
@ 2020-05-06  8:54 Gaurav Jain
  2020-05-08  7:57 ` [edk2-devel] " Ard Biesheuvel
  0 siblings, 1 reply; 2+ messages in thread
From: Gaurav Jain @ 2020-05-06  8:54 UTC (permalink / raw)
  To: devel; +Cc: Jiewen Yao, Chao Zhang, Pankaj Bansal, Gaurav Jain

Firmware management protocol that does not support GetImageInfo
return Unsupported.
hence FMP Image Information Buffer is NULL.
Freeing NULL buffer results in Exception.

Added NULL check for Image Info buffer
and skip processing FMP protocol handle,
which does not support GetImageInfo.

Signed-off-by: Gaurav Jain <gaurav.jain@nxp.com>
---
 .../Universal/SystemFirmwareUpdate/SystemFirmwareUpdateDxe.c         | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/SignedCapsulePkg/Universal/SystemFirmwareUpdate/SystemFirmwareUpdateDxe.c b/SignedCapsulePkg/Universal/SystemFirmwareUpdate/SystemFirmwareUpdateDxe.c
index bdb70bdb32cc..b4438ac6f55a 100644
--- a/SignedCapsulePkg/Universal/SystemFirmwareUpdate/SystemFirmwareUpdateDxe.c
+++ b/SignedCapsulePkg/Universal/SystemFirmwareUpdate/SystemFirmwareUpdateDxe.c
@@ -579,7 +579,7 @@ GetFmpImageDescriptors (
                   &PackageVersionName          // PackageVersionName
                   );
   if (Status != EFI_BUFFER_TOO_SMALL) {
-    DEBUG ((DEBUG_ERROR, "SystemFirmwareUpdateDxe: Unexpected Failure.  Status = %r\n", Status));
+    DEBUG ((DEBUG_INFO, "SystemFirmwareUpdateDxe: Status = %r\n", Status));
     return NULL;
   }
 
@@ -678,6 +678,9 @@ FindMatchingFmpHandles (
                                 &DescriptorSize
                                 );
 
+    if (OriginalFmpImageInfoBuf == NULL) {
+      continue;
+    }
     //
     // Loop through the set of EFI_FIRMWARE_IMAGE_DESCRIPTORs.
     //
-- 
2.7.4


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

* Re: [edk2-devel] [PATCH 1/1] SignedCapsulePkg: Add handling of NULL returned from FMP Descriptor
  2020-05-06  8:54 [PATCH 1/1] SignedCapsulePkg: Add handling of NULL returned from FMP Descriptor Gaurav Jain
@ 2020-05-08  7:57 ` Ard Biesheuvel
  0 siblings, 0 replies; 2+ messages in thread
From: Ard Biesheuvel @ 2020-05-08  7:57 UTC (permalink / raw)
  To: devel, gaurav.jain; +Cc: Jiewen Yao, Chao Zhang, Pankaj Bansal

On 5/6/20 10:54 AM, Gaurav Jain via groups.io wrote:
> Firmware management protocol that does not support GetImageInfo
> return Unsupported.

The UEFI spec does not list EFI_UNSUPPORTED as a permitted return value 
for EFI_FIRMWARE_MANAGEMENT_PROTOCOL.GetImageInfo()

What is the point of producing the protocol in this case?

> hence FMP Image Information Buffer is NULL.
> Freeing NULL buffer results in Exception.
> 
> Added NULL check for Image Info buffer
> and skip processing FMP protocol handle,
> which does not support GetImageInfo.
> 
> Signed-off-by: Gaurav Jain <gaurav.jain@nxp.com>
> ---
>   .../Universal/SystemFirmwareUpdate/SystemFirmwareUpdateDxe.c         | 5 ++++-
>   1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/SignedCapsulePkg/Universal/SystemFirmwareUpdate/SystemFirmwareUpdateDxe.c b/SignedCapsulePkg/Universal/SystemFirmwareUpdate/SystemFirmwareUpdateDxe.c
> index bdb70bdb32cc..b4438ac6f55a 100644
> --- a/SignedCapsulePkg/Universal/SystemFirmwareUpdate/SystemFirmwareUpdateDxe.c
> +++ b/SignedCapsulePkg/Universal/SystemFirmwareUpdate/SystemFirmwareUpdateDxe.c
> @@ -579,7 +579,7 @@ GetFmpImageDescriptors (
>                     &PackageVersionName          // PackageVersionName
>                     );
>     if (Status != EFI_BUFFER_TOO_SMALL) {
> -    DEBUG ((DEBUG_ERROR, "SystemFirmwareUpdateDxe: Unexpected Failure.  Status = %r\n", Status));
> +    DEBUG ((DEBUG_INFO, "SystemFirmwareUpdateDxe: Status = %r\n", Status));
>       return NULL;
>     }
>   
> @@ -678,6 +678,9 @@ FindMatchingFmpHandles (
>                                   &DescriptorSize
>                                   );
>   
> +    if (OriginalFmpImageInfoBuf == NULL) {
> +      continue;
> +    }
>       //
>       // Loop through the set of EFI_FIRMWARE_IMAGE_DESCRIPTORs.
>       //
> 


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

end of thread, other threads:[~2020-05-08  7:57 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-05-06  8:54 [PATCH 1/1] SignedCapsulePkg: Add handling of NULL returned from FMP Descriptor Gaurav Jain
2020-05-08  7:57 ` [edk2-devel] " Ard Biesheuvel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox