From 6743455e34d1b313d644d9f7ca726b9932effb1f Mon Sep 17 00:00:00 2001 From: Ard Biesheuvel Date: Sat, 4 Nov 2017 21:32:37 +0000 Subject: [PATCH] MdeModulePkg/SdMmcPciHcDxe: call SdMmcFreeTrb() to complete sync operation Currently, we complete a synchronous operation without unmapping the DMA mappings, and free the pages using FreePages () rather than calling EFI_PCI_IO_PROTOCOL::FreeBuffer. This is simply incorrect, but it also breaks non-coherent 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 Reviewed-by: Hao Wu Reviewed-by: Star Zeng --- MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHcDxe.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHcDxe.c b/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHcDxe.c index 23faec5e2b..0be8828abf 100644 --- a/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHcDxe.c +++ b/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHcDxe.c @@ -1008,13 +1008,7 @@ SdMmcPassThruPassThru ( } Done: - if ((Trb != NULL) && (Trb->AdmaDesc != NULL)) { - FreePages (Trb->AdmaDesc, Trb->AdmaPages); - } - - if (Trb != NULL) { - FreePool (Trb); - } + SdMmcFreeTrb (Trb); return Status; } -- 2.39.5