From patchwork Sun Nov 5 09:30:54 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 117987 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp1586616qgn; Sun, 5 Nov 2017 01:31:07 -0800 (PST) X-Google-Smtp-Source: ABhQp+SzhgqTYI7i84wvtytSykkDYFe4WybpSlbSrQzOitXHuWPpmP5CEOwzr4Bmm+ab4RsTL57u X-Received: by 10.98.224.194 with SMTP id d63mr12984084pfm.21.1509874267298; Sun, 05 Nov 2017 01:31:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1509874267; cv=none; d=google.com; s=arc-20160816; b=TpEhx2Bj+407Cwh+IdQNW0my9I2ZwnxW05cpQMXEitzR7jGe/rxCefsv1fqsVs2CSl tt/mmqfatQBxdAytVW4D26ILpKszy+0vQTj/xicbbOCgNq8gfgqguEfd4YJs3DmeG//9 sBT81YkqcS8YWn1uOp39Z9wEM3LR9vRymNF7shBW6DSdXtgoBEG8odhB6lpf+k+usZPz 7JK8cM2Inu6RYrddJy7hYVEjBGkmRMC+OQWsjRbppoqhcW3yAXjgGOZYLZX+WmwOXnOe Fp0Q8vutrqYuBNjao7o5POyZCTqTmEq5b1uue673e1jfN1djh029ku4cYzGkv52/0Kfd zKFg== 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=nFej10oGWtpAI3APYHTBY3b8NQfirM+fxg27Sa1enyA=; b=tJClRGs6VmDAPcWAq2YIAjnjlMAU96Rn0C9AvYVXI+yzonF2DTz/Gg/0xyu6lvZmrQ YYLbtpjN8fakojoRxRrD3gTtTrbMGdastZypBM9NBKavvMUYNGugDvIp9vCwx/tT/tY5 93q8PjmzCGDiqHI2T1rLHknB7MKAMq/0ONFX+beDHDHSI2ceyuh+PV6LJO5QjgfuBBKs ymnLoYbbwwn582qOHEDsROY3g5PU2W18RMs0X9rF7yMnYBJP2MnybvZKRGtczqA10KxG F/Jcn6qZ2qWMy4cmwNu8JXjSwPLQq3bY6ExsDqXCDBfd7IdmHc5uj+8iiCLRXRJIERH0 1TtQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=RDyRgsNR; 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 n8si9648796pgs.144.2017.11.05.01.31.05 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 05 Nov 2017 01:31:07 -0800 (PST) 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=RDyRgsNR; 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 17DBE2034EE35; Sun, 5 Nov 2017 01:27:08 -0800 (PST) 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:c0c::244; helo=mail-wr0-x244.google.com; envelope-from=ard.biesheuvel@linaro.org; receiver=edk2-devel@lists.01.org Received: from mail-wr0-x244.google.com (mail-wr0-x244.google.com [IPv6:2a00:1450:400c:c0c::244]) (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 873932034EE25 for ; Sun, 5 Nov 2017 01:27:06 -0800 (PST) Received: by mail-wr0-x244.google.com with SMTP id 4so1713180wrt.0 for ; Sun, 05 Nov 2017 01:31:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=N4ro6MRLhZYpnci628/WuKKkJ98WOfOYxIkN8s0Wcto=; b=RDyRgsNRdvvoQ3CxxPRfAIH/oPJGWFsGU/OZN8mqrKYWW1XBGTVNKTGfJM8eklZ6Ma /WgdtZwFgevOGC3nhn5HKSwHSRzRaVYfbd5mpEzT2vtXSI/Yk8/og4rcyaD+Fl08m72B U/5I3/kxK3YEVVqCwj3B7Xiu+puei2J5m8OEk= 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=N4ro6MRLhZYpnci628/WuKKkJ98WOfOYxIkN8s0Wcto=; b=F1WhCXxn8FCeAK4/r+NEWnMdib4ffclBaO64w0TRzf1lLaPK2+Z7eIsmAFyf9cyH7R iwgfpnNDWoJcL3oswk0xCXiMYpKX8DZ8TQss5ORADcIFWNpXU6+tHW3kK4wDuCTkdfgR UJ6eACBqMqZmi0rs9ojZdYY8Fdrg2bTnd4UnG4DRx6zNdSfz0aqXJLRHmuk2y81PS8az CSGp2Bf96SnPrPfD2CxV9UFTH07Mal+RAcxRGpYtEqro9XwvKMNdaaJvkzX1ftmp0oMU hdg4OWWWAS3+4+F1E7gFl7bB6ZwCe9oCPtftN1uJab/B/FUmrwT9fqFUIJtUBlcQceyf AZiA== X-Gm-Message-State: AMCzsaX0t4L12ycRvH7zuJWgWBE7NCKych0LCtCk9ocY7FNtg1PWNF/q H98/I0BC2EzYqfa0pvoOWlFynb2EKDU= X-Received: by 10.223.130.196 with SMTP id 62mr10872497wrc.60.1509874261948; Sun, 05 Nov 2017 01:31:01 -0800 (PST) Received: from localhost.localdomain ([105.129.222.2]) by smtp.gmail.com with ESMTPSA id x65sm4304052wmg.11.2017.11.05.01.30.59 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 05 Nov 2017 01:31:00 -0800 (PST) From: Ard Biesheuvel To: edk2-devel@lists.01.org Date: Sun, 5 Nov 2017 09:30:54 +0000 Message-Id: <20171105093054.22349-1-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.11.0 Subject: [edk2] [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: , 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" 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 incorrecnt, 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 --- MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHcDxe.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) -- 2.11.0 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel Reviewed-by: Hao Wu Signed-off-by: Ard Biesheuvel diff --git a/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHcDxe.c b/MdeModulePkg/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 ( } Done: - if ((Trb != NULL) && (Trb->AdmaDesc != NULL)) { - FreePages (Trb->AdmaDesc, Trb->AdmaPages); - } - - if (Trb != NULL) { - FreePool (Trb); - } + SdMmcFreeTrb (Trb); return Status; }