From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Permerror (SPF Permanent Error: More than 10 MX records returned) identity=mailfrom; client-ip=192.55.52.136; helo=mga12.intel.com; envelope-from=jiaxin.wu@intel.com; receiver=edk2-devel@lists.01.org Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 1B1FA21B02821 for ; Tue, 12 Dec 2017 03:22:15 -0800 (PST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga106.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 12 Dec 2017 03:26:54 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.45,395,1508828400"; d="scan'208";a="1888416" Received: from tuozhan-mobl.ccr.corp.intel.com (HELO JIAXINWU-MOBL2.ccr.corp.intel.com) ([10.254.209.49]) by fmsmga008.fm.intel.com with ESMTP; 12 Dec 2017 03:26:53 -0800 From: Jiaxin Wu To: edk2-devel@lists.01.org Cc: Siyuan Fu , Heyi Guo , Ye Ting Date: Tue, 12 Dec 2017 19:26:41 +0800 Message-Id: <1513078001-5392-1-git-send-email-jiaxin.wu@intel.com> X-Mailer: git-send-email 1.9.5.msysgit.1 Subject: [Patch] MdeModulePkg/UefiPxeBcDxe: Discard the normal ICMP packets and recycle the received ICMP data. X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Dec 2017 11:22:16 -0000 This patch is to discard the normal ICMP packets and recycle the received ICMP data to avoid the memory leak. Cc: Siyuan Fu Cc: Heyi Guo Cc: Ye Ting Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Jiaxin Wu Tested-by: Heyi Guo --- 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