MdeModulePkg/UefiPxeBcDxe: Discard the normal ICMP packets and recycle the received ICMP data.

This patch is to discard the normal ICMP packets and recycle the received
ICMP data to avoid the memory leak.

Cc: Siyuan Fu <siyuan.fu@intel.com>
Cc: Heyi Guo <heyi.guo@linaro.org>
Cc: Ye Ting <ting.ye@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jiaxin Wu <jiaxin.wu@intel.com>
Tested-by: Heyi Guo <heyi.guo@linaro.org>
Reviewed-by: Fu Siyuan <siyuan.fu@intel.com>
This commit is contained in:
Jiaxin Wu 2017-12-07 18:37:03 +08:00
parent 19bf8314dc
commit 3fe97d9459

View File

@ -166,15 +166,17 @@ IcmpErrorListenHandlerDpc (
return;
}
if (EFI_ERROR (Status) || (RxData == NULL)) {
//
// Only process the normal packets and the icmp error packets, if RxData is NULL
// with Status == EFI_SUCCESS or EFI_ICMP_ERROR, just resume the receive although
// this should be a bug of the low layer (IP).
//
if (RxData == NULL) {
goto Resume;
}
if (Status != EFI_ICMP_ERROR) {
//
// The return status should be recognized as EFI_ICMP_ERROR.
//
goto CleanUp;
}
if (EFI_IP4 (RxData->Header->SourceAddress) != 0 &&
(NTOHL (Mode->SubnetMask.Addr[0]) != 0) &&
IP4_NET_EQUAL (NTOHL(Mode->StationIp.Addr[0]), EFI_NTOHL (RxData->Header->SourceAddress), NTOHL (Mode->SubnetMask.Addr[0])) &&
@ -216,8 +218,6 @@ IcmpErrorListenHandlerDpc (
CopiedPointer += CopiedLen;
}
goto Resume;
CleanUp:
gBS->SignalEvent (RxData->RecycleSignal);