[edk2-devel] NULL Pointer Check is needed for InternalImageHandleToFvHandle of DxeServicesLib

Cai, Weihao weihao.cai at intel.com
Fri Nov 13 09:08:24 UTC 2020


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 at 01D6B9DF.9634B310]

Best Regards
Rick Cai



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#67528): https://edk2.groups.io/g/devel/message/67528
Mute This Topic: https://groups.io/mt/78233251/1813853
Group Owner: devel+owner at edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [edk2-devel-archive at redhat.com]
-=-=-=-=-=-=-=-=-=-=-=-


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/edk2-devel-archive/attachments/20201113/9b25c524/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.jpg
Type: image/jpeg
Size: 38891 bytes
Desc: image001.jpg
URL: <http://listman.redhat.com/archives/edk2-devel-archive/attachments/20201113/9b25c524/attachment.jpg>


More information about the edk2-devel-archive mailing list