From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=192.55.52.93; helo=mga11.intel.com; envelope-from=star.zeng@intel.com; receiver=edk2-devel@lists.01.org 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 48963203555F9 for ; Mon, 6 Nov 2017 00:52:28 -0800 (PST) Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 06 Nov 2017 00:56:26 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.44,351,1505804400"; d="scan'208";a="169805392" Received: from fmsmsx107.amr.corp.intel.com ([10.18.124.205]) by orsmga005.jf.intel.com with ESMTP; 06 Nov 2017 00:56:25 -0800 Received: from fmsmsx118.amr.corp.intel.com (10.18.116.18) by fmsmsx107.amr.corp.intel.com (10.18.124.205) with Microsoft SMTP Server (TLS) id 14.3.319.2; Mon, 6 Nov 2017 00:56:16 -0800 Received: from shsmsx101.ccr.corp.intel.com (10.239.4.153) by fmsmsx118.amr.corp.intel.com (10.18.116.18) with Microsoft SMTP Server (TLS) id 14.3.319.2; Mon, 6 Nov 2017 00:56:16 -0800 Received: from shsmsx102.ccr.corp.intel.com ([169.254.2.175]) by SHSMSX101.ccr.corp.intel.com ([169.254.1.159]) with mapi id 14.03.0319.002; Mon, 6 Nov 2017 16:56:14 +0800 From: "Zeng, Star" To: Ard Biesheuvel , "edk2-devel@lists.01.org" CC: "Tian, Feng" , "Dong, Eric" , "Zeng, Star" Thread-Topic: [PATCH v2] MdeModulePkg/SdMmcPciHcDxe: call SdMmcFreeTrb() to complete sync operation Thread-Index: AQHTVhjOf5OiE2uTlECMWdkCNNMCt6MHDbug Date: Mon, 6 Nov 2017 08:56:14 +0000 Message-ID: <0C09AFA07DD0434D9E2A0C6AEB0483103B9B2080@shsmsx102.ccr.corp.intel.com> References: <20171105093054.22349-1-ard.biesheuvel@linaro.org> In-Reply-To: <20171105093054.22349-1-ard.biesheuvel@linaro.org> 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 v2] MdeModulePkg/SdMmcPciHcDxe: call SdMmcFreeTrb() to complete sync operation 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: Mon, 06 Nov 2017 08:52:28 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Except the typo "incorrecnt" needs to be "incorrect" in commit log, others = are good to me. With typo fixed, Reviewed-by: Star Zeng -----Original Message----- From: Ard Biesheuvel [mailto:ard.biesheuvel@linaro.org]=20 Sent: Sunday, November 5, 2017 5:31 PM To: edk2-devel@lists.01.org Cc: Tian, Feng ; Zeng, Star ; Don= g, Eric ; Ard Biesheuvel Subject: [PATCH v2] MdeModulePkg/SdMmcPciHcDxe: call SdMmcFreeTrb() to comp= lete sync operation Currently, we complete a synchronous operation without unmapping the DMA ma= ppings, and free the pages using FreePages () rather than calling EFI_PCI_I= O_PROTOCOL::FreeBuffer. This is simply incorrecnt, but it also breaks non-c= oherent DMA as well as DMA protection and/or memory encryption so let's do = it correctly and call SdMmcFreeTrb() instead. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ard Biesheuvel --- MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHcDxe.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHcDxe.c b/MdeModule= Pkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHcDxe.c index 23faec5e2be0..0be8828abfcc 100644 --- a/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHcDxe.c +++ b/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHcDxe.c @@ -1008,13 +1008,7 @@ SdMmcPassThruPassThru ( } =20 Done: - if ((Trb !=3D NULL) && (Trb->AdmaDesc !=3D NULL)) { - FreePages (Trb->AdmaDesc, Trb->AdmaPages); - } - - if (Trb !=3D NULL) { - FreePool (Trb); - } + SdMmcFreeTrb (Trb); =20 return Status; } -- 2.11.0