diff options
author | Trammell Hudson <hudson@trmm.net> | 2021-07-13 09:09:31 +0800 |
---|---|---|
committer | mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> | 2021-07-14 03:07:48 +0000 |
commit | d0b6596b8e7ad72c86de0b9faa342a7a866bc87e (patch) | |
tree | 4dd89421b968024b701229e961dfbc0d70589374 | |
parent | 9bf4aee7340c331a47d3a60388d478461979a45d (diff) | |
download | edk2-d0b6596b8e7ad72c86de0b9faa342a7a866bc87e.zip edk2-d0b6596b8e7ad72c86de0b9faa342a7a866bc87e.tar.gz edk2-d0b6596b8e7ad72c86de0b9faa342a7a866bc87e.tar.bz2 |
MdeModulePkg/RamDiskDxe: Init list head before registering RamDisk protocol
REF:https://bugzilla.tianocore.org/show_bug.cgi?id=3483
This patch initializes the linked list RegisteredRamDisks in
RamDiskDxeEntryPoint before the registration of gEfiRamDiskProtocolGuid
with InstallMultipleProtocolInterfaces, allowing ramdisks to be created
via a callback installed with RegisterProtocolNotify as soon as the
protocol is registered.
Without this, calling RamDisk->Register() in the callback causes a crash:
ASSERT [RamDiskDxe] MdePkg/Library/BaseLib/LinkedList.c(75): List->ForwardLink != ((void *) 0)
Signed-off-by: Trammell Hudson <hudson@trmm.net>
Cc: Daniel Schaefer <daniel.schaefer@hpe.com>
Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Hao A Wu <hao.a.wu@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Zhichao Gao <zhichao.gao@intel.com>
Reviewed-by: Hao A Wu <hao.a.wu@intel.com>
-rw-r--r-- | MdeModulePkg/Universal/Disk/RamDiskDxe/RamDiskDriver.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/MdeModulePkg/Universal/Disk/RamDiskDxe/RamDiskDriver.c b/MdeModulePkg/Universal/Disk/RamDiskDxe/RamDiskDriver.c index fcbf4f1..13e2aed 100644 --- a/MdeModulePkg/Universal/Disk/RamDiskDxe/RamDiskDriver.c +++ b/MdeModulePkg/Universal/Disk/RamDiskDxe/RamDiskDriver.c @@ -155,6 +155,12 @@ RamDiskDxeEntryPoint ( }
//
+ // Initialize the list of registered RAM disks maintained by the driver
+ // before installing the protocol
+ //
+ InitializeListHead (&RegisteredRamDisks);
+
+ //
// Install the EFI_RAM_DISK_PROTOCOL and RAM disk private data onto a
// new handle
//
@@ -170,11 +176,6 @@ RamDiskDxeEntryPoint ( goto ErrorExit;
}
- //
- // Initialize the list of registered RAM disks maintained by the driver
- //
- InitializeListHead (&RegisteredRamDisks);
-
Status = EfiCreateEventReadyToBootEx (
TPL_CALLBACK,
RamDiskAcpiCheck,
|