* [Patch] MdeModulePkg/UefiPxeBcDxe: Discard the normal ICMP packets and recycle the received ICMP data.
@ 2017-12-12 11:26 Jiaxin Wu
2017-12-13 1:25 ` Fu, Siyuan
0 siblings, 1 reply; 2+ messages in thread
From: Jiaxin Wu @ 2017-12-12 11:26 UTC (permalink / raw)
To: edk2-devel; +Cc: Siyuan Fu, Heyi Guo, Ye Ting
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>
---
MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcImpl.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcImpl.c b/MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcImpl.c
index 6d4f33f..4bfeaf3 100644
--- a/MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcImpl.c
+++ b/MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcImpl.c
@@ -164,17 +164,19 @@ IcmpErrorListenHandlerDpc (
// The reception is actively aborted by the consumer, directly return.
//
return;
}
- if (EFI_ERROR (Status) || (RxData == NULL)) {
+ if (RxData == NULL) {
+ goto Resume;
+ }
+
+ if (Status != EFI_ICMP_ERROR) {
//
- // 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).
+ // The return status should be recognized as EFI_ICMP_ERROR.
//
- goto Resume;
+ 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])) &&
@@ -214,12 +216,10 @@ IcmpErrorListenHandlerDpc (
);
}
CopiedPointer += CopiedLen;
}
- goto Resume;
-
CleanUp:
gBS->SignalEvent (RxData->RecycleSignal);
Resume:
Ip4->Receive (Ip4, &(Private->IcmpErrorRcvToken));
--
1.9.5.msysgit.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [Patch] MdeModulePkg/UefiPxeBcDxe: Discard the normal ICMP packets and recycle the received ICMP data.
2017-12-12 11:26 [Patch] MdeModulePkg/UefiPxeBcDxe: Discard the normal ICMP packets and recycle the received ICMP data Jiaxin Wu
@ 2017-12-13 1:25 ` Fu, Siyuan
0 siblings, 0 replies; 2+ messages in thread
From: Fu, Siyuan @ 2017-12-13 1:25 UTC (permalink / raw)
To: Wu, Jiaxin, edk2-devel@lists.01.org; +Cc: Heyi Guo, Ye, Ting
Reviewed-by: Fu Siyuan <siyuan.fu@intel.com>
> -----Original Message-----
> From: Wu, Jiaxin
> Sent: Tuesday, December 12, 2017 7:27 PM
> To: edk2-devel@lists.01.org
> Cc: Fu, Siyuan <siyuan.fu@intel.com>; Heyi Guo <heyi.guo@linaro.org>; Ye,
> Ting <ting.ye@intel.com>
> Subject: [Patch] 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>
> ---
> MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcImpl.c | 14 +++++++-----
> --
> 1 file changed, 7 insertions(+), 7 deletions(-)
>
> diff --git a/MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcImpl.c
> b/MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcImpl.c
> index 6d4f33f..4bfeaf3 100644
> --- a/MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcImpl.c
> +++ b/MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcImpl.c
> @@ -164,17 +164,19 @@ IcmpErrorListenHandlerDpc (
> // The reception is actively aborted by the consumer, directly return.
> //
> return;
> }
>
> - if (EFI_ERROR (Status) || (RxData == NULL)) {
> + if (RxData == NULL) {
> + goto Resume;
> + }
> +
> + if (Status != EFI_ICMP_ERROR) {
> //
> - // 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).
> + // The return status should be recognized as EFI_ICMP_ERROR.
> //
> - goto Resume;
> + 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])) &&
> @@ -214,12 +216,10 @@ IcmpErrorListenHandlerDpc (
> );
> }
> CopiedPointer += CopiedLen;
> }
>
> - goto Resume;
> -
> CleanUp:
> gBS->SignalEvent (RxData->RecycleSignal);
>
> Resume:
> Ip4->Receive (Ip4, &(Private->IcmpErrorRcvToken));
> --
> 1.9.5.msysgit.1
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-12-13 1:20 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-12-12 11:26 [Patch] MdeModulePkg/UefiPxeBcDxe: Discard the normal ICMP packets and recycle the received ICMP data Jiaxin Wu
2017-12-13 1:25 ` Fu, Siyuan
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox