From nobody Mon Dec 23 17:55:34 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 1515554195322202.1914983207363; Tue, 9 Jan 2018 19:16:35 -0800 (PST) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 4BEA02236BAA0; Tue, 9 Jan 2018 19:11:22 -0800 (PST) Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) (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 C8824222EDCE2 for ; Tue, 9 Jan 2018 19:11:20 -0800 (PST) Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga105.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 09 Jan 2018 19:16:32 -0800 Received: from fanwang2-hp.ccr.corp.intel.com ([10.239.9.33]) by fmsmga002.fm.intel.com with ESMTP; 09 Jan 2018 19:16:30 -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: Pass (sender SPF authorized) identity=mailfrom; client-ip=192.55.52.43; helo=mga05.intel.com; envelope-from=fan.wang@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.46,337,1511856000"; d="scan'208";a="8879736" From: Wang Fan To: edk2-devel@lists.01.org Date: Wed, 10 Jan 2018 11:16:27 +0800 Message-Id: <1515554188-2560-2-git-send-email-fan.wang@intel.com> X-Mailer: git-send-email 1.9.5.msysgit.1 In-Reply-To: <1515554188-2560-1-git-send-email-fan.wang@intel.com> References: <1515554188-2560-1-git-send-email-fan.wang@intel.com> Subject: [edk2] [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: , Cc: Ye Ting , Fu Siyuan , Jiaxin Wu 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" * 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 Cc: Ye Ting Cc: Fu Siyuan Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Wang Fan Reviewed-by: Fu Siyuan --- MdeModulePkg/Library/DxeIpIoLib/DxeIpIoLib.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/MdeModulePkg/Library/DxeIpIoLib/DxeIpIoLib.c b/MdeModulePkg/Li= brary/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; } =20 - if (((EFI_SUCCESS !=3D Status) && (EFI_ICMP_ERROR !=3D Status)) || (NULL= =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 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 !=3D NULL) { + goto CleanUp; + } else { + goto Resume; + } + } + + // + // if RxData is NULL with Status =3D=3D EFI_SUCCESS or EFI_ICMP_ERROR, t= his 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; --=20 1.9.5.msysgit.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel