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

Laszlo Ersek lersek at redhat.com
Fri Nov 13 22:12:08 UTC 2020


On 11/13/20 10:08, Cai, Weihao wrote:
> 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

Please file a new ticket at <https://bugzilla.tianocore.org/> with this
information, and please consider submitting a patch to the mailing list
for review.

Please talk to your colleagues about the expected git settings in your
edk2 clone, and the patch submission process.

Thanks
Laszlo



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#67535): https://edk2.groups.io/g/devel/message/67535
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]
-=-=-=-=-=-=-=-=-=-=-=-





More information about the edk2-devel-archive mailing list