Series Reviewed-by: Jiaxin Wu <[email protected]>

> -----Original Message-----
> From: Wang, Fan
> Sent: Wednesday, January 10, 2018 11:16 AM
> To: [email protected]
> Cc: Wu, Jiaxin <[email protected]>; Ye, Ting <[email protected]>; Fu,
> Siyuan <[email protected]>
> Subject: [Patch 1/2] MdeModulePkg: Freed the received packet buffer if it is
> not expected.
> 
> * When the packet is not normal packet or icmp error packet, the code
>   does not recycle it by signal RecycleSignal event, and this will
>   result some memory leak. This patch is to fix this issue.
> 
> Cc: Jiaxin Wu <[email protected]>
> Cc: Ye Ting <[email protected]>
> Cc: Fu Siyuan <[email protected]>
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Wang Fan <[email protected]>
> ---
>  MdeModulePkg/Library/DxeIpIoLib/DxeIpIoLib.c | 18 ++++++++++++++----
>  1 file changed, 14 insertions(+), 4 deletions(-)
> 
> diff --git a/MdeModulePkg/Library/DxeIpIoLib/DxeIpIoLib.c
> b/MdeModulePkg/Library/DxeIpIoLib/DxeIpIoLib.c
> index a06c0b6..c7bc1aa 100644
> --- a/MdeModulePkg/Library/DxeIpIoLib/DxeIpIoLib.c
> +++ b/MdeModulePkg/Library/DxeIpIoLib/DxeIpIoLib.c
> @@ -1037,16 +1037,26 @@ IpIoListenHandlerDpc (
>      // The reception is actively aborted by the consumer, directly return.
>      //
>      return;
>    }
> 
> -  if (((EFI_SUCCESS != Status) && (EFI_ICMP_ERROR != Status)) || (NULL ==
> RxData)) {
> +  if ((EFI_SUCCESS != Status) && (EFI_ICMP_ERROR != Status)) {
>      //
> -    // @bug Only process the normal packets and the icmp error packets, if
> RxData is NULL
> -    // @bug with Status == EFI_SUCCESS or EFI_ICMP_ERROR, just resume
> the receive although
> -    // @bug this should be a bug of the low layer (IP).
> +    // Only process the normal packets and the icmp error packets.
>      //
> +    if (RxData != NULL) {
> +      goto CleanUp;
> +    } else {
> +      goto Resume;
> +    }
> +  }
> +
> +  //
> +  // if RxData is NULL with Status == EFI_SUCCESS or EFI_ICMP_ERROR, this
> should be a code issue in the low layer (IP).
> +  //
> +  ASSERT (RxData != NULL);
> +  if (RxData == NULL) {
>      goto Resume;
>    }
> 
>    if (NULL == IpIo->PktRcvdNotify) {
>      goto CleanUp;
> --
> 1.9.5.msysgit.1

_______________________________________________
edk2-devel mailing list
[email protected]
https://lists.01.org/mailman/listinfo/edk2-devel

Reply via email to