From patchwork Sat Nov 4 21:40:12 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 117982 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp1200815qgn; Sat, 4 Nov 2017 14:40:24 -0700 (PDT) X-Google-Smtp-Source: ABhQp+RqR5b6o/6Z6CVG4q9777gRrXjjWPvd93f7TiTB5WDv0duKS40bnPdNN7GNfcDgDXVcwY6p X-Received: by 10.98.156.15 with SMTP id f15mr12058526pfe.35.1509831624894; Sat, 04 Nov 2017 14:40:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1509831624; cv=none; d=google.com; s=arc-20160816; b=iTGhAUI7AWmA3ejL3x597UM7qncbgEvvQnh/dZEoGw73utnn56ron2nL9TAPRSA9Wh gY8KL9bgpixe0bRr08oZKK6z7FwCHxq27cnz0woBpEIklrs/GDojkeSbWUlffjWgGWz1 cqw+OTLduBcasyPuCa5PqkwyyqG1gLz/seGv4Op1fH+XKer2yIB9zEpw4WmwvdFK5AzT lUlc+z96yV+1JrSIp7mFt6hf6G8pv5mkp+LFpPbMX7jJ3jw2AZfpqhssqGYvHZzdZWmp +vAJZ+wmUuFdAZisiKZxWJ+TNqlMpOm0YlJzaElPz0lNDOrU6sr9Da5+BnM/tpjbzrRv /5Fw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:cc :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:message-id:date:to:from:dkim-signature :delivered-to:arc-authentication-results; bh=3dVOkPf1+iPH5suLseZeYEeIZc51XRchdiQwGidpLP4=; b=l24VW4sVzBVh3cFYwNxJ7hFJVgQnjGGiAccvtL/p3WOnGu7pmmwlMctNvhrblKK8oD bxk0e8TyAcwnMPRENU127u48Awf1lkalAgM4M5g2fTAU4ypuZysGvf2w1tiGECcXgr8R KAYc2pqmtADfa57bMIT4f8xSWsWk11a2Rk8GX6swKcumlHvi6MHPZmPue1qnD4dXJNf+ q3TL53aHrFtTSr+KqKkDciV2IBxmMCu1GJZLpVxS7TKsUBbQEG0TvCWpQM+ZW9qhKnHV OFX1Vcu7nQxyt/phOxIkRzBoYATWnCUlPL3kDdGDqsG7t8ucXw1w1wtnj9LEJb9wW/P9 5pwA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=J0jH0uhs; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 2001:19d0:306:5::1 as permitted sender) smtp.mailfrom=edk2-devel-bounces@lists.01.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from ml01.01.org (ml01.01.org. [2001:19d0:306:5::1]) by mx.google.com with ESMTPS id f3si9578397pfd.106.2017.11.04.14.40.24 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 04 Nov 2017 14:40:24 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 2001:19d0:306:5::1 as permitted sender) client-ip=2001:19d0:306:5::1; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=J0jH0uhs; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 2001:19d0:306:5::1 as permitted sender) smtp.mailfrom=edk2-devel-bounces@lists.01.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 0003120352602; Sat, 4 Nov 2017 14:36:26 -0700 (PDT) X-Original-To: edk2-devel@lists.01.org Delivered-To: edk2-devel@lists.01.org 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-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 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: [edk2] [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: , Cc: feng.tian@intel.com, eric.dong@intel.com, star.zeng@intel.com, Ard Biesheuvel MIME-Version: 1.0 Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" 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(-) -- 2.11.0 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel 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) {