Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b4dff287 authored by Vladimir Kondratiev's avatar Vladimir Kondratiev Committed by Vineet Gupta
Browse files

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: f2e3d553 ("ARC: dma: reintroduce platform specific dma<->phys")
Cc: stable@vger.kernel.org #4.6+
Signed-off-by: default avatarVladimir Kondratiev <vladimir.kondratiev@intel.com>
Signed-off-by: default avatarVineet Gupta <vgupta@synopsys.com>
parent 627c88b6
Loading
Loading
Loading
Loading
+2 −1
Original line number Original line Diff line number Diff line
@@ -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,
static void arc_dma_free(struct device *dev, size_t size, void *vaddr,
		dma_addr_t dma_handle, struct dma_attrs *attrs)
		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;
	int is_non_coh = 1;


	is_non_coh = dma_get_attr(DMA_ATTR_NON_CONSISTENT, attrs) ||
	is_non_coh = dma_get_attr(DMA_ATTR_NON_CONSISTENT, attrs) ||