]> git.proxmox.com Git - mirror_edk2.git/commit
MdeModulePkg PartitionDxe: Add Re-entry handling logic for BindingStop
authorHao Wu <hao.a.wu@intel.com>
Fri, 11 Mar 2016 07:33:54 +0000 (15:33 +0800)
committerHao Wu <hao.a.wu@intel.com>
Tue, 29 Mar 2016 07:50:01 +0000 (15:50 +0800)
commite33257215b984fd624cc51b33e9cc14d7321eab6
treec4e23d36e5608972f84d6aacd27801f171816824
parentd4de4f99dac4a42b43b07ee360212a7bec820640
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>
MdeModulePkg/Universal/Disk/PartitionDxe/Partition.c
MdeModulePkg/Universal/Disk/PartitionDxe/Partition.h