On 7/13/21 11:44 AM, Wu, Hao A wrote:
-----Original Message-----
From: [email protected] <[email protected]> On Behalf Of Daniel
Schaefer
Sent: Tuesday, July 13, 2021 9:10 AM
To: [email protected]
Cc: Trammell Hudson <[email protected]>; Daniel Schaefer
<[email protected]>; Wang, Jian J <[email protected]>; Wu,
Hao A <[email protected]>; Ni, Ray <[email protected]>; Gao, Zhichao
<[email protected]>
Subject: [edk2-devel] [PATCH v1 1/1] RamDiskDxe: Initialize list head before
registering RAM disk protocol
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]>
Thanks a lot for the fix.
Reviewed-by: Hao A Wu <[email protected]>
I will modify the subject a little bit when merging:
MdeModulePkg/RamDiskDxe: Init list head before registering RamDisk protocol
Sure, that's good. Thanks!
Best Regards,
Hao Wu
---
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 (#77745): https://edk2.groups.io/g/devel/message/77745
Mute This Topic: https://groups.io/mt/84169086/21656
Group Owner: [email protected]
Unsubscribe: https://edk2.groups.io/g/devel/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-