audk/MdeModulePkg/Core
Hua Ma 5ece2ad36c MdeModulePkg/Core/Dxe: Add lock protection in CoreLocateHandleBuffer()
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3666

Currently, CoreLocateHandleBuffer() follows three steps:
1) get the size of protocol database firstly
2) allocate the buffer based on the size
3) get the protocol database into the buffer
There is no lock protection for the whole three steps. If a new protocol
added in step 2) by other task, e.g. (event timer handle USB device
hotplug). The size of protocol database may be increased and cannot fit
into the previous buffer in step 3). The protocol database cannot be
returned successfully, EFI_BUFFER_TOO_SMALL error will be returned.

This patch adds the lock to protect the whole three steps.
It can make sure the correct protocol database be returned.

Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Dandan Bi <dandan.bi@intel.com>
Signed-off-by: Hua Ma <hua.ma@intel.com>
Reviewed-by: Dandan Bi dandan.bi@intel.com
Reviewed-by: Liming Gao gaoliming@byosoft.com.cn
2021-10-08 06:57:55 +00:00
..
Dxe MdeModulePkg/Core/Dxe: Add lock protection in CoreLocateHandleBuffer() 2021-10-08 06:57:55 +00:00
DxeIplPeim MdeModulePkg/DxeIplPeim: Support GHCB pages when creating page tables 2020-08-16 16:45:42 +00:00
Pei MdeModulePkg/Core/Pei: Fix pointer size mismatch in EvacuateTempRam() 2021-09-16 01:51:36 +00:00
PiSmmCore MdeModulePkg/PiSmmCore: Drop deprecated image profiling commands 2021-09-01 04:58:21 +00:00
RuntimeDxe MdeModulePkg: document workaround for EFI_RUNTIME_EVENT_ENTRY PI spec bug 2019-10-09 09:40:09 +02:00