public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* NULL Pointer Check is needed for InternalImageHandleToFvHandle of DxeServicesLib
@ 2020-11-13  9:08 Cai, Weihao
  2020-11-13 22:12 ` [edk2-devel] " Laszlo Ersek
  0 siblings, 1 reply; 2+ messages in thread
From: Cai, Weihao @ 2020-11-13  9:08 UTC (permalink / raw)
  To: devel@edk2.groups.io; +Cc: Dong, Jun Z


[-- Attachment #1.1: Type: text/plain, Size: 915 bytes --]

Hi EDK2 Dev,

We met a system hang issue recently and after investigation, it was caused by invalid data returned by "InternalImageHandleToFvHandle" of DxeServicesLib.

We call GetSectionFromAnyFv-> InternalImageHandleToFvHandle to get handle.
But InternalImageHandleToFvHandle cannot locate LoadedImageProtocol (This is expected). The returned status is "Invalid Parameter" and "LoadedImage" pointer is NULL.
The problem is InternalImageHandleToFvHandle does not check returned status or "LoadedImage" pointer, just return "LoadedImage->DeviceHandle".
Since "LoadedImage" pointer is NULL, "LoadedImage->DeviceHandle" is invalid handle (random data, but not NULL) which cause system hang.

I think InternalImageHandleToFvHandle should check returned status or "LoadedImage" pointer. If it is failed, just return NULL, not any random data.
[cid:image001.jpg@01D6B9DF.9634B310]

Best Regards
Rick Cai


[-- Attachment #1.2: Type: text/html, Size: 3657 bytes --]

[-- Attachment #2: image001.jpg --]
[-- Type: image/jpeg, Size: 38891 bytes --]

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

end of thread, other threads:[~2020-11-13 22:12 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-11-13  9:08 NULL Pointer Check is needed for InternalImageHandleToFvHandle of DxeServicesLib Cai, Weihao
2020-11-13 22:12 ` [edk2-devel] " Laszlo Ersek

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