diff options
author | Vladimir Kondratiev | 2016-07-03 09:07:48 +0200 |
---|---|---|
committer | Vineet Gupta | 2016-07-20 18:54:22 +0200 |
commit | b4dff2874006e54b60ce4f4dbcfec9ab81c6aff4 (patch) | |
tree | 5e1305e3d3287a8a270e116fd17b92d15b5ce319 /arch/arc/mm/dma.c | |
parent | ARC: typo fix in mm/ioremap.c (diff) | |
download | kernel-qcow2-linux-b4dff2874006e54b60ce4f4dbcfec9ab81c6aff4.tar.gz kernel-qcow2-linux-b4dff2874006e54b60ce4f4dbcfec9ab81c6aff4.tar.xz kernel-qcow2-linux-b4dff2874006e54b60ce4f4dbcfec9ab81c6aff4.zip |
ARC: dma: fix address translation in arc_dma_free
page should be calculated using physical address.
If platform uses non-trivial dma-to-phys memory translation,
dma_handle should be converted to physicval address before
calculation of page.
Failing to do so results in struct page * pointing to
wrong or non-existent memory.
Fixes: f2e3d55397ff ("ARC: dma: reintroduce platform specific dma<->phys")
Cc: stable@vger.kernel.org #4.6+
Signed-off-by: Vladimir Kondratiev <vladimir.kondratiev@intel.com>
Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
Diffstat (limited to 'arch/arc/mm/dma.c')
-rw-r--r-- | arch/arc/mm/dma.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/arch/arc/mm/dma.c b/arch/arc/mm/dma.c index 73d7e4c75b7d..ab74b5d9186c 100644 --- a/arch/arc/mm/dma.c +++ b/arch/arc/mm/dma.c @@ -92,7 +92,8 @@ static void *arc_dma_alloc(struct device *dev, size_t size, static void arc_dma_free(struct device *dev, size_t size, void *vaddr, dma_addr_t dma_handle, struct dma_attrs *attrs) { - struct page *page = virt_to_page(dma_handle); + phys_addr_t paddr = plat_dma_to_phys(dev, dma_handle); + struct page *page = virt_to_page(paddr); int is_non_coh = 1; is_non_coh = dma_get_attr(DMA_ATTR_NON_CONSISTENT, attrs) || |