diff options
author | Haibo Chen <haibo.chen@freescale.com> | 2015-08-25 10:02:11 +0800 |
---|---|---|
committer | Nitin Garg <nitin.garg@freescale.com> | 2015-09-17 09:24:24 -0500 |
commit | 065700dfce5e04c2caf12ce6f3d3e471569e95fd (patch) | |
tree | 4e6eca573c2b99a1a91cba541c894b41ec7c1b74 /include | |
parent | 4d417901059e4ff7242756049947d502f77648e9 (diff) |
mmc: sdhci: fix dma memory leak in sdhci_pre_req()
Currently one mrq->data maybe execute dma_map_sg() twice
when mmc subsystem prepare over one new request, and the
following log show up:
sdhci[sdhci_pre_dma_transfer] invalid cookie: 24, next-cookie 25
In this condition, mrq->date map a dma-memory(1) in sdhci_pre_req
for the first time, and map another dma-memory(2) in sdhci_prepare_data
for the second time. But driver only unmap the dma-memory(2), and
dma-memory(1) never unmapped, which cause the dma memory leak issue.
This patch use another method to map the dma memory for the mrq->data
which can fix this dma memory leak issue.
Fixes: 348487cb28e6 ("mmc: sdhci: use pipeline mmc requests to improve performance")
Reported-and-tested-by: Jiri Slaby <jslaby@suse.cz>
Signed-off-by: Haibo Chen <haibo.chen@freescale.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
(cherry picked from commit d31911b9374a76560d2c8ea4aa6ce5781621e81d)
Conflicts:
drivers/mmc/host/sdhci.c
drivers/mmc/host/sdhci.h
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/mmc/core.h | 1 | ||||
-rw-r--r-- | include/linux/mmc/sdhci.h | 1 |
2 files changed, 1 insertions, 1 deletions
diff --git a/include/linux/mmc/core.h b/include/linux/mmc/core.h index 96fb4f244ca6..67f74bf6fb68 100644 --- a/include/linux/mmc/core.h +++ b/include/linux/mmc/core.h @@ -121,6 +121,7 @@ struct mmc_data { struct mmc_request *mrq; /* associated request */ unsigned int sg_len; /* size of scatter list */ + int sg_count; /* mapped sg entries */ struct scatterlist *sg; /* I/O scatter list */ s32 host_cookie; /* host private data */ }; diff --git a/include/linux/mmc/sdhci.h b/include/linux/mmc/sdhci.h index 0fdff063287f..d8a6ed9e14b8 100644 --- a/include/linux/mmc/sdhci.h +++ b/include/linux/mmc/sdhci.h @@ -192,7 +192,6 @@ struct sdhci_host { #define SDHCI_TUNING_MODE_1 0 struct timer_list tuning_timer; /* Timer for tuning */ - struct sdhci_host_next next_data; unsigned long private[0] ____cacheline_aligned; }; #endif /* LINUX_MMC_SDHCI_H */ |