From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=2a00:1450:400c:c09::243; helo=mail-wm0-x243.google.com; envelope-from=ard.biesheuvel@linaro.org; receiver=edk2-devel@lists.01.org Received: from mail-wm0-x243.google.com (mail-wm0-x243.google.com [IPv6:2a00:1450:400c:c09::243]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id C3702202E5E58 for ; Sat, 4 Nov 2017 14:36:25 -0700 (PDT) Received: by mail-wm0-x243.google.com with SMTP id r68so7583564wmr.3 for ; Sat, 04 Nov 2017 14:40:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=0UmGoFmFEN7Vk9Ca4lQEs7li0h5oO8tJ9h34q+D7VMo=; b=J0jH0uhs0K8ZkH0rRxccs7g6cVyonWHdLmD4kSeedWWvtM3cmGe9OopWyXOi/6fD/i 9twg39FkuYiUmIHYxWp60gPPECLfIwSiGXkiRsEQewMmRmY1qRs7zfWHEbGshUYqOZ9G /vyq0hXd7/ptCdlkqzS89cdYvwh+yFIX4wF1Y= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=0UmGoFmFEN7Vk9Ca4lQEs7li0h5oO8tJ9h34q+D7VMo=; b=b1JkuPko5jifaDCueOIZO2MnzPkPn109pgKK6m3KY+4mZypCgW83yx6YyRsF0OcyUH akcLNu1MEeQNeB4KKQLPpysfn8g03cD3SQdx43d5iRUBP5LXOP3jVPefsD4pCLF4WCzl HZNSv9MZP0KobNYx0BYYhgEvGoiRnA5cNAf2z8qm4XjWk6Cco067i7kzjeksxPktJfVJ 1+KnmL3LaY0J6ut1+jFoZ398XtTHh5QWts6t9kvE38HYR45DAk0fF1U/CK9xevHzWwLR lg9GowoBLalUdpye7C3Zi3RxDleG6nMb5g1Ofi09GCxFbVW3/da7PTUfSCWdH2cKIjEw ilCA== X-Gm-Message-State: AJaThX4h39qJyHPAhRuyt8FDCJmlMqt7j/QcEXaVNmjxFO8uKe0Z6Lf0 irhmnS+JpBK3ya9MezvvLx80zDNGteg= X-Google-Smtp-Source: ABhQp+QVY/jQkYiuKaHfoWuKogJCc1rHIaY+l+mokmaFpXFmINw3+hBiwNd7tJd0SSb2PmliMz8q2g== X-Received: by 10.28.24.70 with SMTP id 67mr1871028wmy.7.1509831620239; Sat, 04 Nov 2017 14:40:20 -0700 (PDT) Received: from localhost.localdomain ([105.129.222.2]) by smtp.gmail.com with ESMTPSA id e77sm5443350wmi.16.2017.11.04.14.40.17 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 04 Nov 2017 14:40:18 -0700 (PDT) From: Ard Biesheuvel To: edk2-devel@lists.01.org Cc: feng.tian@intel.com, star.zeng@intel.com, eric.dong@intel.com, Ard Biesheuvel Date: Sat, 4 Nov 2017 21:40:12 +0000 Message-Id: <20171104214012.30888-1-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.11.0 Subject: [PATCH] MdeModulePkg/SdMmcPciHcDxe: use FreeBuffer not FreePages from DMA buffer 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: Sat, 04 Nov 2017 21:36:26 -0000 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 --- 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