From: "Daniel Schaefer" <daniel.schaefer@hpe.com>
To: <devel@edk2.groups.io>
Cc: Trammell Hudson <hudson@trmm.net>,
Daniel Schaefer <daniel.schaefer@hpe.com>,
Jian J Wang <jian.j.wang@intel.com>,
Hao A Wu <hao.a.wu@intel.com>, Ray Ni <ray.ni@intel.com>,
Zhichao Gao <zhichao.gao@intel.com>
Subject: [PATCH v1 1/1] RamDiskDxe: Initialize list head before registering RAM disk protocol
Date: Tue, 13 Jul 2021 09:09:31 +0800 [thread overview]
Message-ID: <20210713010931.445739-2-daniel.schaefer@hpe.com> (raw)
In-Reply-To: <20210713010931.445739-1-daniel.schaefer@hpe.com>
From: Trammell Hudson <hudson@trmm.net>
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>
---
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
next prev parent reply other threads:[~2021-07-13 1:10 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-07-13 1:09 [PATCH v1 0/1] RamDiskDxe: Initialize list head before registering RAM disk protocol Daniel Schaefer
2021-07-13 1:09 ` Daniel Schaefer [this message]
2021-07-13 3:44 ` [edk2-devel] [PATCH v1 1/1] " Wu, Hao A
2021-07-13 9:30 ` Daniel Schaefer
2021-07-14 3:09 ` Wu, Hao A
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=20210713010931.445739-2-daniel.schaefer@hpe.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