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.120; helo=mga04.intel.com; envelope-from=jiaxin.wu@intel.com; receiver=edk2-devel@lists.01.org Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) (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 A6521222DDBF9 for ; Mon, 15 Jan 2018 16:39:41 -0800 (PST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 15 Jan 2018 16:45:00 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.46,366,1511856000"; d="scan'208";a="21874949" Received: from fmsmsx106.amr.corp.intel.com ([10.18.124.204]) by fmsmga004.fm.intel.com with ESMTP; 15 Jan 2018 16:45:00 -0800 Received: from fmsmsx122.amr.corp.intel.com (10.18.125.37) by FMSMSX106.amr.corp.intel.com (10.18.124.204) with Microsoft SMTP Server (TLS) id 14.3.319.2; Mon, 15 Jan 2018 16:45:00 -0800 Received: from shsmsx101.ccr.corp.intel.com (10.239.4.153) by fmsmsx122.amr.corp.intel.com (10.18.125.37) with Microsoft SMTP Server (TLS) id 14.3.319.2; Mon, 15 Jan 2018 16:44:59 -0800 Received: from shsmsx103.ccr.corp.intel.com ([169.254.4.213]) by SHSMSX101.ccr.corp.intel.com ([169.254.1.159]) with mapi id 14.03.0319.002; Tue, 16 Jan 2018 08:44:58 +0800 From: "Wu, Jiaxin" To: "Wang, Fan" , "edk2-devel@lists.01.org" CC: "Ye, Ting" , "Fu, Siyuan" Thread-Topic: [Patch 1/2] MdeModulePkg: Freed the received packet buffer if it is not expected. Thread-Index: AQHTicFwNPceUGN1x0qv7OizazIyZ6N1srHw Date: Tue, 16 Jan 2018 00:44:56 +0000 Message-ID: <895558F6EA4E3B41AC93A00D163B72741635D0E9@SHSMSX103.ccr.corp.intel.com> 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-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiN2E4MDc2ZTYtMjRkNi00NzY4LWE3NzMtN2M3Y2JhNTVjMGJhIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE2LjUuOS4zIiwiVHJ1c3RlZExhYmVsSGFzaCI6Ilh4ZTBhdDhiVmphUTdxZXNMSE9wUE5VY0xBRjNKYitUR1wvWWV1THVxbnN3PSJ9 x-ctpclassification: CTP_NT 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: Tue, 16 Jan 2018 00:39:42 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Series Reviewed-by: Jiaxin Wu > -----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