MdeModulePkg PartitionDxe: Add Re-entry handling logic for BindingStop
There are scenario when the BindingStop service of PartitionDxe driver be re-entered. An example will be ejecting a DVD from a SATA DVDROM and then run "reconnect -r" under shell. In this specific case, part of the calling stack will be: PartitionDriverBindingStop() (PartitionDxe) -> Stop first child handle (PartitionDxe) -> ScsiDiskFlushBlocksEx() (ScsiDiskDxe) -> A media change is detected (ScsiDiskDxe) -> Reinstall of BlockIO(2) protocols (ScsiDiskDxe) -> Entering PartitionDriverBindingStop() again (PartitionDxe) -> Potential risk of referencing already stopped child handle (PartitionDxe) ... The current code has potential issue of referencing of already stopped child handle. This commit adds re-entry handling logic to resolve such issue. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Hao Wu <hao.a.wu@intel.com> Reviewed-by: Feng Tian <feng.tian@intel.com>
This commit is contained in:
@@ -61,6 +61,7 @@ typedef struct {
|
||||
UINT64 Start;
|
||||
UINT64 End;
|
||||
UINT32 BlockSize;
|
||||
BOOLEAN InStop;
|
||||
|
||||
EFI_GUID *EspGuid;
|
||||
|
||||
@@ -345,6 +346,20 @@ PartitionInstallChildHandle (
|
||||
IN BOOLEAN InstallEspGuid
|
||||
);
|
||||
|
||||
/**
|
||||
Test to see if there is any child on ControllerHandle.
|
||||
|
||||
@param[in] ControllerHandle Handle of device to test.
|
||||
|
||||
@retval TRUE There are children on the ControllerHandle.
|
||||
@retval FALSE No child is on the ControllerHandle.
|
||||
|
||||
**/
|
||||
BOOLEAN
|
||||
HasChildren (
|
||||
IN EFI_HANDLE ControllerHandle
|
||||
);
|
||||
|
||||
/**
|
||||
Install child handles if the Handle supports GPT partition structure.
|
||||
|
||||
|
Reference in New Issue
Block a user