From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Permerror (SPF Permanent Error: Void lookup limit of 2 exceeded) identity=mailfrom; client-ip=192.55.52.88; helo=mga01.intel.com; envelope-from=siyuan.fu@intel.com; receiver=edk2-devel@lists.01.org Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) (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 75634222DDBE3 for ; Sun, 14 Jan 2018 21:41:44 -0800 (PST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 14 Jan 2018 21:47:02 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.46,362,1511856000"; d="scan'208";a="10704496" Received: from fmsmsx108.amr.corp.intel.com ([10.18.124.206]) by fmsmga002.fm.intel.com with ESMTP; 14 Jan 2018 21:47:02 -0800 Received: from shsmsx152.ccr.corp.intel.com (10.239.6.52) by FMSMSX108.amr.corp.intel.com (10.18.124.206) with Microsoft SMTP Server (TLS) id 14.3.319.2; Sun, 14 Jan 2018 21:47:02 -0800 Received: from shsmsx103.ccr.corp.intel.com ([169.254.4.213]) by SHSMSX152.ccr.corp.intel.com ([169.254.6.93]) with mapi id 14.03.0319.002; Mon, 15 Jan 2018 13:47:00 +0800 From: "Fu, Siyuan" To: "Wang, Fan" , "edk2-devel@lists.01.org" CC: "Wu, Jiaxin" , "Ye, Ting" Thread-Topic: [Patch 1/2] MdeModulePkg: Freed the received packet buffer if it is not expected. Thread-Index: AQHTicFwZl3Qt9sNLEymDhR6YykmjKN0dPUw Date: Mon, 15 Jan 2018 05:46:59 +0000 Message-ID: References: <1515554188-2560-1-git-send-email-fan.wang@intel.com> <1515554188-2560-2-git-send-email-fan.wang@intel.com> In-Reply-To: <1515554188-2560-2-git-send-email-fan.wang@intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ctpclassification: CTP_NT x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiMjE1ZTE5MjItNzkxOC00YTE1LTg4ZWQtNjg0OTdjZmEyNWRkIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjIuNS4xOCIsIlRydXN0ZWRMYWJlbEhhc2giOiI0QVwvRUlRMmVoXC9pSnRYeFZvRTdFSzdKUDJLelJFRzNXRGJ4ZVkzbHpzaWs2TVZWWExOQnFURDFUb2k4dlBwU28ifQ== dlp-product: dlpe-windows dlp-version: 11.0.0.116 dlp-reaction: no-action x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Subject: Re: [Patch 1/2] MdeModulePkg: Freed the received packet buffer if it is not expected. X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Jan 2018 05:41:45 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Fu Siyuan > -----Original Message----- > From: Wang, Fan > Sent: Wednesday, January 10, 2018 11:16 AM > To: edk2-devel@lists.01.org > Cc: Wu, Jiaxin ; Ye, Ting ; Fu, > Siyuan > Subject: [Patch 1/2] MdeModulePkg: Freed the received packet buffer if it > is not expected. >=20 > * 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. >=20 > Cc: Jiaxin Wu > Cc: Ye Ting > Cc: Fu Siyuan > Contributed-under: TianoCore Contribution Agreement 1.0 > Signed-off-by: Wang Fan > --- > MdeModulePkg/Library/DxeIpIoLib/DxeIpIoLib.c | 18 ++++++++++++++---- > 1 file changed, 14 insertions(+), 4 deletions(-) >=20 > 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 retur= n. > // > return; > } >=20 > - if (((EFI_SUCCESS !=3D Status) && (EFI_ICMP_ERROR !=3D Status)) || (NU= LL =3D=3D > RxData)) { > + if ((EFI_SUCCESS !=3D Status) && (EFI_ICMP_ERROR !=3D Status)) { > // > - // @bug Only process the normal packets and the icmp error packets, > if RxData is NULL > - // @bug with Status =3D=3D EFI_SUCCESS or EFI_ICMP_ERROR, just resum= e 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 !=3D NULL) { > + goto CleanUp; > + } else { > + goto Resume; > + } > + } > + > + // > + // if RxData is NULL with Status =3D=3D EFI_SUCCESS or EFI_ICMP_ERROR,= this > should be a code issue in the low layer (IP). > + // > + ASSERT (RxData !=3D NULL); > + if (RxData =3D=3D NULL) { > goto Resume; > } >=20 > if (NULL =3D=3D IpIo->PktRcvdNotify) { > goto CleanUp; > -- > 1.9.5.msysgit.1