[3.19.y-ckt stable] Patch "mmc: sdhci check parameters before call dma_free_coherent" has been added to staging queue

Kamal Mostafa kamal at canonical.com
Thu Aug 27 22:08:28 UTC 2015


This is a note to let you know that I have just added a patch titled

    mmc: sdhci check parameters before call dma_free_coherent

to the linux-3.19.y-queue branch of the 3.19.y-ckt extended stable tree 
which can be found at:

    http://kernel.ubuntu.com/git/ubuntu/linux.git/log/?h=linux-3.19.y-queue

This patch is scheduled to be released in version 3.19.8-ckt6.

If you, or anyone else, feels it should not be added to this tree, please 
reply to this email.

For more information about the 3.19.y-ckt tree, see
https://wiki.ubuntu.com/Kernel/Dev/ExtendedStable

Thanks.
-Kamal

------

>From 25d04dfccbcebbe9de52254510c12b062b4aef82 Mon Sep 17 00:00:00 2001
From: Peng Fan <van.freenix at gmail.com>
Date: Mon, 22 Jun 2015 11:41:23 +0800
Subject: mmc: sdhci check parameters before call dma_free_coherent

commit 7ac020366b0a436d726408841160b5dc32c19214 upstream.

We should not call dma_free_coherent if host->adma_table is NULL,
otherwise may trigger panic.

Fixes: d1e49f77d7c7 ("mmc: sdhci: convert ADMA descriptors to a...")
Signed-off-by: Peng Fan <van.freenix at gmail.com>
Acked-by: Adrian Hunter <adrian.hunter at intel.com>
Signed-off-by: Ulf Hansson <ulf.hansson at linaro.org>
Signed-off-by: Kamal Mostafa <kamal at canonical.com>
---
 drivers/mmc/host/sdhci.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
index 5c8b463..afb477a 100644
--- a/drivers/mmc/host/sdhci.c
+++ b/drivers/mmc/host/sdhci.c
@@ -2971,8 +2971,11 @@ int sdhci_add_host(struct sdhci_host *host)
 						      GFP_KERNEL);
 		host->align_buffer = kmalloc(host->align_buffer_sz, GFP_KERNEL);
 		if (!host->adma_table || !host->align_buffer) {
-			dma_free_coherent(mmc_dev(mmc), host->adma_table_sz,
-					  host->adma_table, host->adma_addr);
+			if (host->adma_table)
+				dma_free_coherent(mmc_dev(mmc),
+						  host->adma_table_sz,
+						  host->adma_table,
+						  host->adma_addr);
 			kfree(host->align_buffer);
 			pr_warn("%s: Unable to allocate ADMA buffers - falling back to standard DMA\n",
 				mmc_hostname(mmc));
--
1.9.1





More information about the kernel-team mailing list