diff options
author | Marek Szyprowski <m.szyprowski@samsung.com> | 2013-02-08 10:54:48 +0100 |
---|---|---|
committer | Marek Szyprowski <m.szyprowski@samsung.com> | 2013-02-25 15:30:44 +0100 |
commit | d589829107c5528164a9b7dfe50d0001780865ed (patch) | |
tree | ea20dc2f831a19940ed4473eb163c277b73b5115 /arch/arm/mm/dma-mapping.c | |
parent | 60460abffc71523d65774f43ce1252972eeb0629 (diff) | |
download | op-kernel-dev-d589829107c5528164a9b7dfe50d0001780865ed.zip op-kernel-dev-d589829107c5528164a9b7dfe50d0001780865ed.tar.gz |
ARM: DMA-mapping: fix memory leak in IOMMU dma-mapping implementation
This patch removes page_address() usage in IOMMU-aware dma-mapping
implementation and replaced it with direct use of the cpu virtual address
provided by the caller. page_address() returned incorrect address for
pages remapped in atomic pool, what caused memory leak.
Reported-by: Hiroshi Doyu <hdoyu@nvidia.com>
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Tested-by: Hiroshi Doyu <hdoyu@nvidia.com>
Diffstat (limited to 'arch/arm/mm/dma-mapping.c')
-rw-r--r-- | arch/arm/mm/dma-mapping.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/arch/arm/mm/dma-mapping.c b/arch/arm/mm/dma-mapping.c index 6e25115..c7e3759 100644 --- a/arch/arm/mm/dma-mapping.c +++ b/arch/arm/mm/dma-mapping.c @@ -1292,11 +1292,11 @@ err_mapping: return NULL; } -static void __iommu_free_atomic(struct device *dev, struct page **pages, +static void __iommu_free_atomic(struct device *dev, void *cpu_addr, dma_addr_t handle, size_t size) { __iommu_remove_mapping(dev, handle, size); - __free_from_pool(page_address(pages[0]), size); + __free_from_pool(cpu_addr, size); } static void *arm_iommu_alloc_attrs(struct device *dev, size_t size, @@ -1379,7 +1379,7 @@ void arm_iommu_free_attrs(struct device *dev, size_t size, void *cpu_addr, } if (__in_atomic_pool(cpu_addr, size)) { - __iommu_free_atomic(dev, pages, handle, size); + __iommu_free_atomic(dev, cpu_addr, handle, size); return; } |