From: Trammell Hudson <[email protected]> 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 <[email protected]> Cc: Daniel Schaefer <[email protected]> Cc: Jian J Wang <[email protected]> Cc: Hao A Wu <[email protected]> Cc: Ray Ni <[email protected]> Cc: Zhichao Gao <[email protected]> --- MdeModulePkg/Universal/Disk/RamDiskDxe/RamDiskDriver.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/MdeModulePkg/Universal/Disk/RamDiskDxe/RamDiskDriver.c b/MdeModulePkg/Universal/Disk/RamDiskDxe/RamDiskDriver.c index fcbf4f117dc6..13e2aed87cef 100644 --- a/MdeModulePkg/Universal/Disk/RamDiskDxe/RamDiskDriver.c +++ b/MdeModulePkg/Universal/Disk/RamDiskDxe/RamDiskDriver.c @@ -154,6 +154,12 @@ RamDiskDxeEntryPoint ( goto ErrorExit; } + // + // 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, -- 2.31.1 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#77723): https://edk2.groups.io/g/devel/message/77723 Mute This Topic: https://groups.io/mt/84169086/21656 Group Owner: [email protected] Unsubscribe: https://edk2.groups.io/g/devel/unsub [[email protected]] -=-=-=-=-=-=-=-=-=-=-=-
