public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: Ard Biesheuvel <ard.biesheuvel@linaro.org>
To: edk2-devel@lists.01.org
Cc: feng.tian@intel.com, star.zeng@intel.com, eric.dong@intel.com,
	Ard Biesheuvel <ard.biesheuvel@linaro.org>
Subject: [PATCH] MdeModulePkg/SdMmcPciHcDxe: use FreeBuffer not FreePages from DMA buffer
Date: Sat,  4 Nov 2017 21:40:12 +0000	[thread overview]
Message-ID: <20171104214012.30888-1-ard.biesheuvel@linaro.org> (raw)

Don't use EFI_PCI_IO_PROTOCOL::FreePages () to free an allocation
created with EFI_PCI_IO_PROTOCOL::AllocatePages (). It is simply
incorrect, but given that it may interfere with IOMMU DMA protection
and/or memory encryption, it could pose a security risk as well.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
---
 MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHcDxe.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHcDxe.c b/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHcDxe.c
index 23faec5e2be0..a6005dd33bce 100644
--- a/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHcDxe.c
+++ b/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHcDxe.c
@@ -1009,7 +1009,7 @@ SdMmcPassThruPassThru (
 
 Done:
   if ((Trb != NULL) && (Trb->AdmaDesc != NULL)) {
-    FreePages (Trb->AdmaDesc, Trb->AdmaPages);
+    Private->PciIo->FreeBuffer (Private->PciIo, Trb->AdmaPages, Trb->AdmaDesc);
   }
 
   if (Trb != NULL) {
-- 
2.11.0



             reply	other threads:[~2017-11-04 21:36 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-04 21:40 Ard Biesheuvel [this message]
2017-11-04 22:10 ` [PATCH] MdeModulePkg/SdMmcPciHcDxe: use FreeBuffer not FreePages from DMA buffer Ard Biesheuvel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20171104214012.30888-1-ard.biesheuvel@linaro.org \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox