From nobody Mon May 6 19:02:24 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1513078017105251.82573166842894; Tue, 12 Dec 2017 03:26:57 -0800 (PST) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 3D3EA220EE10C; Tue, 12 Dec 2017 03:22:17 -0800 (PST) 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) 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 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 X-Original-To: edk2-devel@lists.01.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; 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 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.45,395,1508828400"; d="scan'208";a="1888416" From: Jiaxin Wu To: edk2-devel@lists.01.org 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: [edk2] [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: , Cc: Ye Ting , Siyuan Fu , Heyi Guo MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail: RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" 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 Reviewed-by: Fu Siyuan --- MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcImpl.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcImpl.c b/MdeM= odulePkg/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; } =20 - if (EFI_ERROR (Status) || (RxData =3D=3D NULL)) { + if (RxData =3D=3D NULL) { + goto Resume; + } + + if (Status !=3D EFI_ICMP_ERROR) { // - // Only process the normal packets and the icmp error packets, if RxDa= ta is NULL - // with Status =3D=3D EFI_SUCCESS or EFI_ICMP_ERROR, just resume the r= eceive 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; } =20 if (EFI_IP4 (RxData->Header->SourceAddress) !=3D 0 && (NTOHL (Mode->SubnetMask.Addr[0]) !=3D 0) && IP4_NET_EQUAL (NTOHL(Mode->StationIp.Addr[0]), EFI_NTOHL (RxData->He= ader->SourceAddress), NTOHL (Mode->SubnetMask.Addr[0])) && @@ -214,12 +216,10 @@ IcmpErrorListenHandlerDpc ( ); } CopiedPointer +=3D CopiedLen; } =20 - goto Resume; - CleanUp: gBS->SignalEvent (RxData->RecycleSignal); =20 Resume: Ip4->Receive (Ip4, &(Private->IcmpErrorRcvToken)); --=20 1.9.5.msysgit.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel