From: "Cai, Weihao" <weihao.cai@intel.com>
To: "devel@edk2.groups.io" <devel@edk2.groups.io>
Cc: "Dong, Jun Z" <jun.z.dong@intel.com>
Subject: NULL Pointer Check is needed for InternalImageHandleToFvHandle of DxeServicesLib
Date: Fri, 13 Nov 2020 09:08:24 +0000 [thread overview]
Message-ID: <DM6PR11MB3401F1B63AE765508F73A71697E60@DM6PR11MB3401.namprd11.prod.outlook.com> (raw)
[-- 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 --]
next reply other threads:[~2020-11-13 9:08 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-13 9:08 Cai, Weihao [this message]
2020-11-13 22:12 ` [edk2-devel] NULL Pointer Check is needed for InternalImageHandleToFvHandle of DxeServicesLib Laszlo Ersek
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=DM6PR11MB3401F1B63AE765508F73A71697E60@DM6PR11MB3401.namprd11.prod.outlook.com \
--to=devel@edk2.groups.io \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox