* [PATCH v1 0/1] RamDiskDxe: Initialize list head before registering RAM disk protocol @ 2021-07-13 1:09 Daniel Schaefer 2021-07-13 1:09 ` [PATCH v1 1/1] " Daniel Schaefer 0 siblings, 1 reply; 5+ messages in thread From: Daniel Schaefer @ 2021-07-13 1:09 UTC (permalink / raw) To: devel Cc: Daniel Schaefer, Trammell Hudson, Jian J Wang, Hao A Wu, Ray Ni, Zhichao Gao Sending this patch on behalf of Trammell, who asked me to do so, so that he doesn't have to set up git-send-email config. See his PR: https://github.com/tianocore/edk2/pull/1810 Trammell Hudson (1): RamDiskDxe: initialize list head before registering ram disk protocol MdeModulePkg/Universal/Disk/RamDiskDxe/RamDiskDriver.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) Cc: Daniel Schaefer <daniel.schaefer@hpe.com> Cc: Trammell Hudson <hudson@trmm.net> 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> -- 2.31.1 ^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH v1 1/1] RamDiskDxe: Initialize list head before registering RAM disk protocol 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 2021-07-13 3:44 ` [edk2-devel] " Wu, Hao A 0 siblings, 1 reply; 5+ messages in thread From: Daniel Schaefer @ 2021-07-13 1:09 UTC (permalink / raw) To: devel Cc: Trammell Hudson, Daniel Schaefer, Jian J Wang, Hao A Wu, Ray Ni, Zhichao Gao 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 ^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [edk2-devel] [PATCH v1 1/1] RamDiskDxe: Initialize list head before registering RAM disk protocol 2021-07-13 1:09 ` [PATCH v1 1/1] " Daniel Schaefer @ 2021-07-13 3:44 ` Wu, Hao A 2021-07-13 9:30 ` Daniel Schaefer 0 siblings, 1 reply; 5+ messages in thread From: Wu, Hao A @ 2021-07-13 3:44 UTC (permalink / raw) To: devel@edk2.groups.io, daniel.schaefer@hpe.com Cc: Trammell Hudson, Wang, Jian J, Ni, Ray, Gao, Zhichao > -----Original Message----- > From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Daniel > Schaefer > Sent: Tuesday, July 13, 2021 9:10 AM > To: devel@edk2.groups.io > Cc: Trammell Hudson <hudson@trmm.net>; Daniel Schaefer > <daniel.schaefer@hpe.com>; Wang, Jian J <jian.j.wang@intel.com>; Wu, > Hao A <hao.a.wu@intel.com>; Ni, Ray <ray.ni@intel.com>; Gao, Zhichao > <zhichao.gao@intel.com> > Subject: [edk2-devel] [PATCH v1 1/1] RamDiskDxe: Initialize list head before > registering RAM disk protocol > > 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> Thanks a lot for the fix. Reviewed-by: Hao A Wu <hao.a.wu@intel.com> I will modify the subject a little bit when merging: MdeModulePkg/RamDiskDxe: Init list head before registering RamDisk protocol 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 > > > > > ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [edk2-devel] [PATCH v1 1/1] RamDiskDxe: Initialize list head before registering RAM disk protocol 2021-07-13 3:44 ` [edk2-devel] " Wu, Hao A @ 2021-07-13 9:30 ` Daniel Schaefer 2021-07-14 3:09 ` Wu, Hao A 0 siblings, 1 reply; 5+ messages in thread From: Daniel Schaefer @ 2021-07-13 9:30 UTC (permalink / raw) To: Wu, Hao A, devel@edk2.groups.io Cc: Trammell Hudson, Wang, Jian J, Ni, Ray, Gao, Zhichao On 7/13/21 11:44 AM, Wu, Hao A wrote: >> -----Original Message----- >> From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Daniel >> Schaefer >> Sent: Tuesday, July 13, 2021 9:10 AM >> To: devel@edk2.groups.io >> Cc: Trammell Hudson <hudson@trmm.net>; Daniel Schaefer >> <daniel.schaefer@hpe.com>; Wang, Jian J <jian.j.wang@intel.com>; Wu, >> Hao A <hao.a.wu@intel.com>; Ni, Ray <ray.ni@intel.com>; Gao, Zhichao >> <zhichao.gao@intel.com> >> Subject: [edk2-devel] [PATCH v1 1/1] RamDiskDxe: Initialize list head before >> registering RAM disk protocol >> >> 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> > > > Thanks a lot for the fix. > Reviewed-by: Hao A Wu <hao.a.wu@intel.com> > > 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 >> >> >> >> >> > ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [edk2-devel] [PATCH v1 1/1] RamDiskDxe: Initialize list head before registering RAM disk protocol 2021-07-13 9:30 ` Daniel Schaefer @ 2021-07-14 3:09 ` Wu, Hao A 0 siblings, 0 replies; 5+ messages in thread From: Wu, Hao A @ 2021-07-14 3:09 UTC (permalink / raw) To: Daniel Schaefer, devel@edk2.groups.io Cc: Trammell Hudson, Wang, Jian J, Ni, Ray, Gao, Zhichao Patch merged via: PR - https://github.com/tianocore/edk2/pull/1814 Commit - https://github.com/tianocore/edk2/commit/d0b6596b8e7ad72c86de0b9faa342a7a866bc87e Best Regards, Hao Wu > -----Original Message----- > From: Daniel Schaefer <daniel.schaefer@hpe.com> > Sent: Tuesday, July 13, 2021 5:31 PM > To: Wu, Hao A <hao.a.wu@intel.com>; devel@edk2.groups.io > Cc: Trammell Hudson <hudson@trmm.net>; Wang, Jian J > <jian.j.wang@intel.com>; Ni, Ray <ray.ni@intel.com>; Gao, Zhichao > <zhichao.gao@intel.com> > Subject: Re: [edk2-devel] [PATCH v1 1/1] RamDiskDxe: Initialize list head > before registering RAM disk protocol > > On 7/13/21 11:44 AM, Wu, Hao A wrote: > >> -----Original Message----- > >> From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of > Daniel > >> Schaefer > >> Sent: Tuesday, July 13, 2021 9:10 AM > >> To: devel@edk2.groups.io > >> Cc: Trammell Hudson <hudson@trmm.net>; Daniel Schaefer > >> <daniel.schaefer@hpe.com>; Wang, Jian J <jian.j.wang@intel.com>; Wu, > >> Hao A <hao.a.wu@intel.com>; Ni, Ray <ray.ni@intel.com>; Gao, Zhichao > >> <zhichao.gao@intel.com> > >> Subject: [edk2-devel] [PATCH v1 1/1] RamDiskDxe: Initialize list head > >> before registering RAM disk protocol > >> > >> 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> > > > > > > Thanks a lot for the fix. > > Reviewed-by: Hao A Wu <hao.a.wu@intel.com> > > > > 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 > >> > >> > >> > >> > >> > > ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2021-07-14 3:09 UTC | newest] Thread overview: 5+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 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 ` [PATCH v1 1/1] " Daniel Schaefer 2021-07-13 3:44 ` [edk2-devel] " Wu, Hao A 2021-07-13 9:30 ` Daniel Schaefer 2021-07-14 3:09 ` Wu, Hao A
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox