From nobody Mon Dec 23 19:37:18 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 1514870877049218.62194673989688; Mon, 1 Jan 2018 21:27:57 -0800 (PST) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 41EC52205BE93; Mon, 1 Jan 2018 21:22:52 -0800 (PST) Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) (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 224EE21CB2E4A for ; Mon, 1 Jan 2018 21:22:50 -0800 (PST) Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga105.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 01 Jan 2018 21:27:52 -0800 Received: from sfu5-mobl.ccr.corp.intel.com ([10.239.193.25]) by fmsmga004.fm.intel.com with ESMTP; 01 Jan 2018 21:27:51 -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=134.134.136.100; helo=mga07.intel.com; envelope-from=siyuan.fu@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,495,1508828400"; d="scan'208";a="17388522" From: Fu Siyuan To: edk2-devel@lists.01.org Date: Tue, 2 Jan 2018 13:27:40 +0800 Message-Id: <20180102052744.9928-2-siyuan.fu@intel.com> X-Mailer: git-send-email 2.13.0.windows.1 In-Reply-To: <20180102052744.9928-1-siyuan.fu@intel.com> References: <20180102052744.9928-1-siyuan.fu@intel.com> Subject: [edk2] [Patch 1/5] NetworkPkg: Abort the PXE process if DHCP has been started by other instance. 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 , Wang Fan , Wu Jiaxin 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" PXE need to use extended DHCP options and check received offers in callback function, so there is no need to continue the PXE process if DHCP driver has been started by other instance but not PXE driver itself. Cc: Ye Ting Cc: Wu Jiaxin Cc: Wang Fan Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Fu Siyuan --- NetworkPkg/UefiPxeBcDxe/PxeBcDhcp4.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/NetworkPkg/UefiPxeBcDxe/PxeBcDhcp4.c b/NetworkPkg/UefiPxeBcDxe= /PxeBcDhcp4.c index 101c65824a..9c33835759 100644 --- a/NetworkPkg/UefiPxeBcDxe/PxeBcDhcp4.c +++ b/NetworkPkg/UefiPxeBcDxe/PxeBcDhcp4.c @@ -1,7 +1,7 @@ /** @file Functions implementation related with DHCPv4 for UefiPxeBc Driver. =20 - Copyright (c) 2009 - 2017, Intel Corporation. All rights reserved.
+ Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.
=20 This program and the accompanying materials are licensed and made available under the terms and conditions of the BS= D License @@ -1697,13 +1697,8 @@ PxeBcDhcp4Dora ( ZeroMem (Private->OfferCount, sizeof (Private->OfferCount)); ZeroMem (Private->OfferIndex, sizeof (Private->OfferIndex)); =20 - // - // Start DHCPv4 D.O.R.A. process to acquire IPv4 address. This may=20 - // have already been done, thus do not leave in error if the return - // code is EFI_ALREADY_STARTED. - // Status =3D Dhcp4->Start (Dhcp4, NULL); - if (EFI_ERROR (Status) && Status !=3D EFI_ALREADY_STARTED) { + if (EFI_ERROR (Status)) { if (Status =3D=3D EFI_ICMP_ERROR) { PxeMode->IcmpErrorReceived =3D TRUE; } --=20 2.13.0.windows.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel From nobody Mon Dec 23 19:37:18 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 1514870879564302.5430026711864; Mon, 1 Jan 2018 21:27:59 -0800 (PST) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 995272205BE96; Mon, 1 Jan 2018 21:22:52 -0800 (PST) Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) (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 3D6D821CB87BF for ; Mon, 1 Jan 2018 21:22:51 -0800 (PST) Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga105.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 01 Jan 2018 21:27:53 -0800 Received: from sfu5-mobl.ccr.corp.intel.com ([10.239.193.25]) by fmsmga004.fm.intel.com with ESMTP; 01 Jan 2018 21:27:52 -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=134.134.136.100; helo=mga07.intel.com; envelope-from=siyuan.fu@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,495,1508828400"; d="scan'208";a="17388525" From: Fu Siyuan To: edk2-devel@lists.01.org Date: Tue, 2 Jan 2018 13:27:41 +0800 Message-Id: <20180102052744.9928-3-siyuan.fu@intel.com> X-Mailer: git-send-email 2.13.0.windows.1 In-Reply-To: <20180102052744.9928-1-siyuan.fu@intel.com> References: <20180102052744.9928-1-siyuan.fu@intel.com> Subject: [edk2] [Patch 2/5] NetworkPkg: Check allocated buffer pointer before use. 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 , Wang Fan , Wu Jiaxin 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" Cc: Ye Ting Cc: Wu Jiaxin Cc: Wang Fan Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Fu Siyuan --- NetworkPkg/UefiPxeBcDxe/PxeBcDhcp6.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/NetworkPkg/UefiPxeBcDxe/PxeBcDhcp6.c b/NetworkPkg/UefiPxeBcDxe= /PxeBcDhcp6.c index f2239fd8c0..327b4cf1cf 100644 --- a/NetworkPkg/UefiPxeBcDxe/PxeBcDhcp6.c +++ b/NetworkPkg/UefiPxeBcDxe/PxeBcDhcp6.c @@ -2,7 +2,7 @@ Functions implementation related with DHCPv6 for UefiPxeBc Driver. =20 (C) Copyright 2014 Hewlett-Packard Development Company, L.P.
- Copyright (c) 2009 - 2017, Intel Corporation. All rights reserved.
+ Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.
=20 This program and the accompanying materials are licensed and made available under the terms and conditions of the BS= D License @@ -2030,6 +2030,9 @@ PxeBcDhcp6CallBack ( SelectAd =3D &Private->OfferBuffer[Private->SelectIndex - 1].Dhcp6= .Packet.Offer; *NewPacket =3D AllocateZeroPool (SelectAd->Size); ASSERT (*NewPacket !=3D NULL); + if (*NewPacket =3D=3D NULL) { + return EFI_ABORTED; + } CopyMem (*NewPacket, SelectAd, SelectAd->Size); } break; --=20 2.13.0.windows.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel From nobody Mon Dec 23 19:37:18 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 1514870882998749.3893309622055; Mon, 1 Jan 2018 21:28:02 -0800 (PST) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id F39F32205BE99; Mon, 1 Jan 2018 21:22:53 -0800 (PST) Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) (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 3AF0A2205BE92 for ; Mon, 1 Jan 2018 21:22:52 -0800 (PST) Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga105.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 01 Jan 2018 21:27:54 -0800 Received: from sfu5-mobl.ccr.corp.intel.com ([10.239.193.25]) by fmsmga004.fm.intel.com with ESMTP; 01 Jan 2018 21:27: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: Pass (sender SPF authorized) identity=mailfrom; client-ip=134.134.136.100; helo=mga07.intel.com; envelope-from=siyuan.fu@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,495,1508828400"; d="scan'208";a="17388529" From: Fu Siyuan To: edk2-devel@lists.01.org Date: Tue, 2 Jan 2018 13:27:42 +0800 Message-Id: <20180102052744.9928-4-siyuan.fu@intel.com> X-Mailer: git-send-email 2.13.0.windows.1 In-Reply-To: <20180102052744.9928-1-siyuan.fu@intel.com> References: <20180102052744.9928-1-siyuan.fu@intel.com> Subject: [edk2] [Patch 3/5] NetworkPkg: Fix memory leak problem in PXE driver. 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 , Wang Fan , Wu Jiaxin 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" Cc: Ye Ting Cc: Wu Jiaxin Cc: Wang Fan Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Fu Siyuan --- NetworkPkg/UefiPxeBcDxe/PxeBcDhcp6.c | 27 +++++++++++++++++++++------ NetworkPkg/UefiPxeBcDxe/PxeBcDriver.c | 5 ++++- 2 files changed, 25 insertions(+), 7 deletions(-) diff --git a/NetworkPkg/UefiPxeBcDxe/PxeBcDhcp6.c b/NetworkPkg/UefiPxeBcDxe= /PxeBcDhcp6.c index 327b4cf1cf..7c2baa8eac 100644 --- a/NetworkPkg/UefiPxeBcDxe/PxeBcDhcp6.c +++ b/NetworkPkg/UefiPxeBcDxe/PxeBcDhcp6.c @@ -548,6 +548,7 @@ PxeBcExtractBootFileUrl ( if (ModeStr !=3D NULL && *(ModeStr + AsciiStrLen (";mode=3Doctet")) = =3D=3D '\0') { *ModeStr =3D '\0'; } else if (AsciiStrStr (BootFileNamePtr, ";mode=3D") !=3D NULL) { + FreePool (TmpStr); return EFI_INVALID_PARAMETER; } =20 @@ -1005,7 +1006,7 @@ PxeBcRequestBootService ( ); =20 if (EFI_ERROR (Status)) { - return Status; + goto ON_ERROR; } =20 // @@ -1020,7 +1021,7 @@ PxeBcRequestBootService ( // Status =3D Private->Udp6Read->Configure (Private->Udp6Read, &Private->Ud= p6CfgData); if (EFI_ERROR (Status)) { - return Status; + goto ON_ERROR; } =20 Status =3D PxeBc->UdpRead ( @@ -1041,7 +1042,7 @@ PxeBcRequestBootService ( Private->Udp6Read->Configure (Private->Udp6Read, NULL); =20 if (EFI_ERROR (Status)) { - return Status; + goto ON_ERROR; } =20 // @@ -1050,6 +1051,13 @@ PxeBcRequestBootService ( Reply->Length =3D (UINT32) ReadSize; =20 return EFI_SUCCESS; + =20 +ON_ERROR: + if (Discover !=3D NULL) { + FreePool (Discover); + } + + return Status; } =20 =20 @@ -2158,7 +2166,7 @@ PxeBcDhcp6Discover ( (VOID *) Discover ); if (EFI_ERROR (Status)) { - return Status; + goto ON_ERROR; } =20 // @@ -2178,7 +2186,7 @@ PxeBcDhcp6Discover ( // Status =3D Private->Udp6Read->Configure (Private->Udp6Read, &Private->Ud= p6CfgData); if (EFI_ERROR (Status)) { - return Status; + goto ON_ERROR; } =20 Status =3D PxeBc->UdpRead ( @@ -2198,10 +2206,17 @@ PxeBcDhcp6Discover ( // Private->Udp6Read->Configure (Private->Udp6Read, NULL); if (EFI_ERROR (Status)) { - return Status; + goto ON_ERROR; } =20 return EFI_SUCCESS; + +ON_ERROR: + if (Discover !=3D NULL) { + FreePool (Discover); + } + + return Status; } =20 =20 diff --git a/NetworkPkg/UefiPxeBcDxe/PxeBcDriver.c b/NetworkPkg/UefiPxeBcDx= e/PxeBcDriver.c index 09c5753ad9..8dd787be1a 100644 --- a/NetworkPkg/UefiPxeBcDxe/PxeBcDriver.c +++ b/NetworkPkg/UefiPxeBcDxe/PxeBcDriver.c @@ -2,7 +2,7 @@ Driver Binding functions implementationfor for UefiPxeBc Driver. =20 (C) Copyright 2014 Hewlett-Packard Development Company, L.P.
- Copyright (c) 2007 - 2016, Intel Corporation. All rights reserved.
+ Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.
=20 This program and the accompanying materials are licensed and made available under the terms and conditions of the BS= D License @@ -254,6 +254,7 @@ PxeBcDestroyIp4Children ( &Private->PxeBc, NULL ); + FreePool (Private->Ip4Nic->DevicePath); =20 if (Private->Snp !=3D NULL) {=20 // @@ -414,6 +415,8 @@ PxeBcDestroyIp6Children ( &Private->PxeBc, NULL ); + FreePool (Private->Ip6Nic->DevicePath); + =20 if (Private->Snp !=3D NULL) { // // Close SNP from the child virtual handle --=20 2.13.0.windows.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel From nobody Mon Dec 23 19:37:18 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 1514870885305456.4991983486342; Mon, 1 Jan 2018 21:28:05 -0800 (PST) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 577A12205BE9E; Mon, 1 Jan 2018 21:22:54 -0800 (PST) Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) (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 43FA42205BE98 for ; Mon, 1 Jan 2018 21:22:53 -0800 (PST) Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga105.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 01 Jan 2018 21:27:55 -0800 Received: from sfu5-mobl.ccr.corp.intel.com ([10.239.193.25]) by fmsmga004.fm.intel.com with ESMTP; 01 Jan 2018 21:27:54 -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=134.134.136.100; helo=mga07.intel.com; envelope-from=siyuan.fu@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,495,1508828400"; d="scan'208";a="17388532" From: Fu Siyuan To: edk2-devel@lists.01.org Date: Tue, 2 Jan 2018 13:27:43 +0800 Message-Id: <20180102052744.9928-5-siyuan.fu@intel.com> X-Mailer: git-send-email 2.13.0.windows.1 In-Reply-To: <20180102052744.9928-1-siyuan.fu@intel.com> References: <20180102052744.9928-1-siyuan.fu@intel.com> Subject: [edk2] [Patch 4/5] NetworkPkg: Add assert for buffer pointer from DHCP driver. 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 , Wang Fan , Wu Jiaxin 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" The PxeBcDhcp4CallBack() is provided for DHCP driver to invoke packet check during DHCP process, the DHCP driver should make sure Packet and NewPacket has meaningful value. This patch adds assert for this. Cc: Ye Ting Cc: Wu Jiaxin Cc: Wang Fan Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Fu Siyuan --- NetworkPkg/UefiPxeBcDxe/PxeBcDhcp4.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/NetworkPkg/UefiPxeBcDxe/PxeBcDhcp4.c b/NetworkPkg/UefiPxeBcDxe= /PxeBcDhcp4.c index 9c33835759..b2c03eb269 100644 --- a/NetworkPkg/UefiPxeBcDxe/PxeBcDhcp4.c +++ b/NetworkPkg/UefiPxeBcDxe/PxeBcDhcp4.c @@ -1210,6 +1210,8 @@ PxeBcDhcp4CallBack ( return EFI_SUCCESS; } =20 + ASSERT (Packet !=3D NULL); + Private =3D (PXEBC_PRIVATE_DATA *) Context; Mode =3D Private->PxeBc.Mode; Callback =3D Private->PxeBcCallback; @@ -1305,6 +1307,8 @@ PxeBcDhcp4CallBack ( break; =20 case Dhcp4SelectOffer: + ASSERT (NewPacket !=3D NULL); + =20 // // Select offer by the default policy or by order, and record the Sele= ctIndex // and SelectProxyType. --=20 2.13.0.windows.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel From nobody Mon Dec 23 19:37:18 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 1514870888505900.0068425955076; Mon, 1 Jan 2018 21:28:08 -0800 (PST) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id B95502205BEA2; Mon, 1 Jan 2018 21:22:55 -0800 (PST) Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) (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 525E72205BE9D for ; Mon, 1 Jan 2018 21:22:54 -0800 (PST) Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga105.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 01 Jan 2018 21:27:56 -0800 Received: from sfu5-mobl.ccr.corp.intel.com ([10.239.193.25]) by fmsmga004.fm.intel.com with ESMTP; 01 Jan 2018 21:27:55 -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=134.134.136.100; helo=mga07.intel.com; envelope-from=siyuan.fu@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,495,1508828400"; d="scan'208";a="17388535" From: Fu Siyuan To: edk2-devel@lists.01.org Date: Tue, 2 Jan 2018 13:27:44 +0800 Message-Id: <20180102052744.9928-6-siyuan.fu@intel.com> X-Mailer: git-send-email 2.13.0.windows.1 In-Reply-To: <20180102052744.9928-1-siyuan.fu@intel.com> References: <20180102052744.9928-1-siyuan.fu@intel.com> Subject: [edk2] [Patch 5/5] NetworkPkg: Update PXE driver to check for NULL pointer before use it. 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 , Wang Fan , Wu Jiaxin 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 fix the issue that dereferencing of "This" (EFI_LOAD_FILE_= PROTOCOL) in EfiPxeLoadFile() is happening before the NULL check. Cc: Ye Ting Cc: Wu Jiaxin Cc: Wang Fan Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Fu Siyuan Reviewed-by: Sriram Subramanian --- NetworkPkg/UefiPxeBcDxe/PxeBcImpl.c | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/NetworkPkg/UefiPxeBcDxe/PxeBcImpl.c b/NetworkPkg/UefiPxeBcDxe/= PxeBcImpl.c index dc77d256f8..93f3bfa5ba 100644 --- a/NetworkPkg/UefiPxeBcDxe/PxeBcImpl.c +++ b/NetworkPkg/UefiPxeBcDxe/PxeBcImpl.c @@ -1,7 +1,7 @@ /** @file This implementation of EFI_PXE_BASE_CODE_PROTOCOL and EFI_LOAD_FILE_PROT= OCOL. =20 - Copyright (c) 2007 - 2017, Intel Corporation. All rights reserved.
+ Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.
=20 This program and the accompanying materials are licensed and made available under the terms and conditions of the BS= D License @@ -2349,26 +2349,22 @@ EfiPxeLoadFile ( EFI_STATUS Status; EFI_STATUS MediaStatus; =20 - if (FilePath =3D=3D NULL || !IsDevicePathEnd (FilePath)) { + if (This =3D=3D NULL || BufferSize =3D=3D NULL || FilePath =3D=3D NULL |= | !IsDevicePathEnd (FilePath)) { return EFI_INVALID_PARAMETER; } =20 - VirtualNic =3D PXEBC_VIRTUAL_NIC_FROM_LOADFILE (This); - Private =3D VirtualNic->Private; - PxeBc =3D &Private->PxeBc; - UsingIpv6 =3D FALSE; - Status =3D EFI_DEVICE_ERROR; - - if (This =3D=3D NULL || BufferSize =3D=3D NULL) { - return EFI_INVALID_PARAMETER; - } - // // Only support BootPolicy // if (!BootPolicy) { return EFI_UNSUPPORTED; } + =20 + VirtualNic =3D PXEBC_VIRTUAL_NIC_FROM_LOADFILE (This); + Private =3D VirtualNic->Private; + PxeBc =3D &Private->PxeBc; + UsingIpv6 =3D FALSE; + Status =3D EFI_DEVICE_ERROR; =20 // // Check media status before PXE start --=20 2.13.0.windows.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel