diff options
author | vanjeff <vanjeff@6f19259b-4bc3-4df7-8a09-765794883524> | 2008-08-01 08:10:49 +0000 |
---|---|---|
committer | vanjeff <vanjeff@6f19259b-4bc3-4df7-8a09-765794883524> | 2008-08-01 08:10:49 +0000 |
commit | 75b046c3d4aca166de580f5b80c42a14fcbd60eb (patch) | |
tree | 8eaf49b6bbf48843361778e3820ac5930bb78105 /MdeModulePkg/Core/Dxe | |
parent | da770255f25f67ab9fa8a92be33c2fad6c0654d9 (diff) | |
download | edk2-75b046c3d4aca166de580f5b80c42a14fcbd60eb.zip edk2-75b046c3d4aca166de580f5b80c42a14fcbd60eb.tar.gz edk2-75b046c3d4aca166de580f5b80c42a14fcbd60eb.tar.bz2 |
Using Spin lock instead of using RaiseTpl() to prevent UnloadImage() re-entrance.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@5600 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'MdeModulePkg/Core/Dxe')
-rw-r--r-- | MdeModulePkg/Core/Dxe/Image/Image.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/MdeModulePkg/Core/Dxe/Image/Image.c b/MdeModulePkg/Core/Dxe/Image/Image.c index dbb6625..477eaa3 100644 --- a/MdeModulePkg/Core/Dxe/Image/Image.c +++ b/MdeModulePkg/Core/Dxe/Image/Image.c @@ -17,6 +17,8 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. // Module Globals
//
+SPIN_LOCK mUnloadImageLock;
+
LOADED_IMAGE_PRIVATE_DATA *mCurrentImage = NULL;
LOAD_PE32_IMAGE_PRIVATE_DATA mLoadPe32PrivateData = {
@@ -138,6 +140,11 @@ CoreInitializeImageServices ( mCurrentImage = Image;
//
+ // Initialize spin lock
+ //
+ InitializeSpinLock (&mUnloadImageLock);
+
+ //
// Fill in DXE globals
//
gDxeCoreImageHandle = Image->Handle;
@@ -1362,13 +1369,14 @@ CoreUnloadImage ( {
EFI_STATUS Status;
LOADED_IMAGE_PRIVATE_DATA *Image;
- EFI_TPL OldTpl;
//
// Prevent possible reentrance to this function
// for the same ImageHandle
//
- OldTpl = CoreRaiseTpl (TPL_NOTIFY);
+ if (!AcquireSpinLockOrFail (&mUnloadImageLock)) {
+ return EFI_UNSUPPORTED;
+ }
Image = CoreLoadedImageInfo (ImageHandle);
if (Image == NULL ) {
@@ -1404,7 +1412,7 @@ CoreUnloadImage ( }
Done:
- CoreRestoreTpl (OldTpl);
+ ReleaseSpinLock (&mUnloadImageLock);
return Status;
}
|