From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) (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 E7F0B21C9126F for ; Wed, 26 Jul 2017 21:52:29 -0700 (PDT) Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 26 Jul 2017 21:54:33 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.40,418,1496127600"; d="scan'208";a="883270040" Received: from fmsmsx105.amr.corp.intel.com ([10.18.124.203]) by FMSMGA003.fm.intel.com with ESMTP; 26 Jul 2017 21:54:33 -0700 Received: from fmsmsx158.amr.corp.intel.com (10.18.116.75) by FMSMSX105.amr.corp.intel.com (10.18.124.203) with Microsoft SMTP Server (TLS) id 14.3.319.2; Wed, 26 Jul 2017 21:54:32 -0700 Received: from shsmsx101.ccr.corp.intel.com (10.239.4.153) by fmsmsx158.amr.corp.intel.com (10.18.116.75) with Microsoft SMTP Server (TLS) id 14.3.319.2; Wed, 26 Jul 2017 21:54:33 -0700 Received: from shsmsx102.ccr.corp.intel.com ([169.254.2.146]) by SHSMSX101.ccr.corp.intel.com ([169.254.1.197]) with mapi id 14.03.0319.002; Thu, 27 Jul 2017 12:54:30 +0800 From: "Zeng, Star" To: "Ni, Ruiyu" , "edk2-devel@lists.01.org" CC: "Zeng, Star" Thread-Topic: [PATCH] MdeModulePkg/PciBus: Avoid hang when BUS pad resource is not in top Thread-Index: AQHTBoVAvzcLlGsdoEyxJIFamt5XfqJnG7sg Date: Thu, 27 Jul 2017 04:54:30 +0000 Message-ID: <0C09AFA07DD0434D9E2A0C6AEB0483103B8F66F5@shsmsx102.ccr.corp.intel.com> References: <20170727030537.51784-1-ruiyu.ni@intel.com> In-Reply-To: <20170727030537.51784-1-ruiyu.ni@intel.com> Accept-Language: zh-CN, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Subject: Re: [PATCH] MdeModulePkg/PciBus: Avoid hang when BUS pad resource is not in top X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Jul 2017 04:52:30 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Star Zeng -----Original Message----- From: Ni, Ruiyu=20 Sent: Thursday, July 27, 2017 11:06 AM To: edk2-devel@lists.01.org Cc: Zeng, Star Subject: [PATCH] MdeModulePkg/PciBus: Avoid hang when BUS pad resource is n= ot in top PciScanBus() assumes the GetResourcePadding() puts BUS descriptor in the ve= ry beginning, if it's not, the Descriptors will be updated to point to midd= le of the pool buffer, which can cause FreePool(Descriptors) hang in DEBUG image. No functionality impact to RELEASE image. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ruiyu Ni Cc: Star Zeng --- MdeModulePkg/Bus/Pci/PciBusDxe/PciLib.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/MdeModulePkg/Bus/Pci/PciBusDxe/PciLib.c b/MdeModulePkg/Bus/Pci= /PciBusDxe/PciLib.c index e1d62e8c21..8b076e8791 100644 --- a/MdeModulePkg/Bus/Pci/PciBusDxe/PciLib.c +++ b/MdeModulePkg/Bus/Pci/PciBusDxe/PciLib.c @@ -1,7 +1,7 @@ /** @file Internal library implementation for PCI Bus module. =20 -Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.
+Copyright (c) 2006 - 2017, Intel Corporation. All rights reserved.
(C) Copyright 2015 Hewlett Packard Enterprise Development LP
This pro= gram and the accompanying materials are licensed and made available under = the terms and conditions of the BSD License @@ -986,6 +986,7 @@ PciScanBus = ( UINT64 PciAddress; EFI_HPC_PADDING_ATTRIBUTES Attributes; EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR *Descriptors; + EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR *NextDescriptors; UINT16 BusRange; EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *PciRootBridgeIo; BOOLEAN BusPadding; @@ -1143,8 +1144,9 @@ PciScanBus ( } =20 BusRange =3D 0; + NextDescriptors =3D Descriptors; Status =3D PciGetBusRange ( - &Descriptors, + &NextDescriptors, NULL, NULL, &BusRange -- 2.12.2.windows.2