From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: None (no SPF record) identity=mailfrom; client-ip=15.241.140.73; helo=g4t3427.houston.hpe.com; envelope-from=sriram-s@hpe.com; receiver=edk2-devel@lists.01.org Received: from g4t3427.houston.hpe.com (g4t3427.houston.hpe.com [15.241.140.73]) (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 7AFD0222EDCD9 for ; Mon, 1 Jan 2018 21:38:34 -0800 (PST) Received: from G9W8456.americas.hpqcorp.net (g9w8456.houston.hp.com [16.216.161.95]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by g4t3427.houston.hpe.com (Postfix) with ESMTPS id 493E86C for ; Tue, 2 Jan 2018 05:43:35 +0000 (UTC) Received: from G9W8454.americas.hpqcorp.net (2002:10d8:a104::10d8:a104) by G9W8456.americas.hpqcorp.net (2002:10d8:a15f::10d8:a15f) with Microsoft SMTP Server (TLS) id 15.0.1178.4; Tue, 2 Jan 2018 05:43:34 +0000 Received: from NAM02-BL2-obe.outbound.protection.outlook.com (15.241.52.12) by G9W8454.americas.hpqcorp.net (16.216.161.4) with Microsoft SMTP Server (TLS) id 15.0.1178.4 via Frontend Transport; Tue, 2 Jan 2018 05:43:34 +0000 Received: from CS1PR8401MB1013.NAMPRD84.PROD.OUTLOOK.COM (10.169.96.10) by CS1PR8401MB1016.NAMPRD84.PROD.OUTLOOK.COM (10.169.96.13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.366.8; Tue, 2 Jan 2018 05:43:33 +0000 Received: from CS1PR8401MB1013.NAMPRD84.PROD.OUTLOOK.COM ([fe80::5125:8c1:b03b:c74f]) by CS1PR8401MB1013.NAMPRD84.PROD.OUTLOOK.COM ([fe80::5125:8c1:b03b:c74f%17]) with mapi id 15.20.0366.007; Tue, 2 Jan 2018 05:43:33 +0000 From: "Subramanian, Sriram" To: Fu Siyuan , "edk2-devel@lists.01.org" CC: Ye Ting , Wang Fan , Wu Jiaxin Thread-Topic: [edk2] [Patch 5/5] NetworkPkg: Update PXE driver to check for NULL pointer before use it. Thread-Index: AQHTg4p8+JgoHY+i1ECLYtkYGaDIEKNgETKg Date: Tue, 2 Jan 2018 05:43:33 +0000 Message-ID: References: <20180102052744.9928-1-siyuan.fu@intel.com> <20180102052744.9928-6-siyuan.fu@intel.com> In-Reply-To: <20180102052744.9928-6-siyuan.fu@intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=sriram-s@hpe.com; x-originating-ip: [16.242.235.130] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; CS1PR8401MB1016; 7:Dd8KsP3W1B7xNS8wSayRk4cSWlsWXnGn4OS4I2wVv7oIzl1ryxCQbxRvRkq+mfwq49qJnCvixFC5TmUgjnQroRwLXHthEE91H5oi+e97Kp7t6cn173c2i77egsWsxpP+JC45pGj/B3SuMF5tX4sqU6ztAaOyTPN5E+jIfOqkGgdbMX6J/rbTQhzm2fr52keZbv7VpNOlU2U5TLPeHR1Gg8cbsvMfJn6cb9+W5jptkadWkQQh4fFzwOgikH4PYZMb x-ms-exchange-antispam-srfa-diagnostics: SSOS; x-ms-office365-filtering-correlation-id: 2248bc61-1412-49d9-cf2d-08d551a3c2dd x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: UriScan:(222181515654134); BCL:0; PCL:0; RULEID:(4534020)(4602075)(4627115)(8989060)(201703031133081)(201702281549075)(8990040)(5600026)(4604075)(3008032)(48565401081)(2017052603307)(7153060); SRVR:CS1PR8401MB1016; x-ms-traffictypediagnostic: CS1PR8401MB1016: x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(227479698468861)(162533806227266)(222181515654134)(228905959029699); x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(6040470)(2401047)(8121501046)(5005006)(3231023)(944501075)(93006095)(93001095)(10201501046)(3002001)(6055026)(6041268)(20161123560045)(20161123564045)(20161123562045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123558120)(6072148)(201708071742011); SRVR:CS1PR8401MB1016; BCL:0; PCL:0; RULEID:(100000803101)(100110400095); SRVR:CS1PR8401MB1016; x-forefront-prvs: 0540846A1D x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(39860400002)(366004)(346002)(39380400002)(376002)(396003)(189003)(199004)(13464003)(81156014)(5660300001)(54906003)(6246003)(33656002)(76176011)(81166006)(229853002)(53936002)(9686003)(66066001)(7696005)(966005)(7736002)(15650500001)(8676002)(305945005)(478600001)(99286004)(86362001)(105586002)(6306002)(14454004)(6436002)(8936002)(74316002)(106356001)(3280700002)(3660700001)(2900100001)(2906002)(5250100002)(59450400001)(25786009)(53546011)(110136005)(97736004)(2501003)(55016002)(6506007)(6116002)(102836004)(2950100002)(68736007)(3846002)(316002)(4326008); DIR:OUT; SFP:1102; SCL:1; SRVR:CS1PR8401MB1016; H:CS1PR8401MB1013.NAMPRD84.PROD.OUTLOOK.COM; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A:1; LANG:en; received-spf: None (protection.outlook.com: hpe.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: ZL/ZoAbHhtfQYGgaC0+V8afKbcVjtKRijCcWqrWeot+2H3GCPpNTIpuvhnxzPbWGJlpQ6xiOBh0vjMOrpjSGuQ== spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: 2248bc61-1412-49d9-cf2d-08d551a3c2dd X-MS-Exchange-CrossTenant-originalarrivaltime: 02 Jan 2018 05:43:33.2222 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 105b2061-b669-4b31-92ac-24d304d195dc X-MS-Exchange-Transport-CrossTenantHeadersStamped: CS1PR8401MB1016 X-OriginatorOrg: hpe.com Subject: Re: [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: , X-List-Received-Date: Tue, 02 Jan 2018 05:38:35 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Sriram Subramanian -----Original Message----- From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of Fu S= iyuan Sent: Tuesday, January 2, 2018 10:58 AM To: edk2-devel@lists.01.org Cc: Ye Ting ; Wang Fan ; Wu Jiaxin <= jiaxin.wu@intel.com> Subject: [edk2] [Patch 5/5] NetworkPkg: Update PXE driver to check for NULL= pointer before use it. 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 --- 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