Skip to contentSkip to conversation

Patch "ARC: dma: fix address translation in arc_dma_free" has been added to the 4.7-stable tree

PATCH [email protected] 1 participant 1 message Aug 18, 2016

Subsystems (2)
lore
Share & tools
lore

[email protected]

author maintainer Applied
#0 lore raw

This is a note to let you know that I've just added the patch titled

ARC: dma: fix address translation in arc_dma_free

to the 4.7-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
arc-dma-fix-address-translation-in-arc_dma_free.patch
and it can be found in the queue-4.7 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.

Quoted 1 line

From b4dff2874006e54b60ce4f4dbcfec9ab81c6aff4 Mon Sep 17 00:00:00 2001

From: Vladimir Kondratiev <[email protected]>
Date: Sun, 3 Jul 2016 10:07:48 +0300
Subject: ARC: dma: fix address translation in arc_dma_free

From: Vladimir Kondratiev <[email protected]>

commit b4dff2874006e54b60ce4f4dbcfec9ab81c6aff4 upstream.

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")
---
 arch/arc/mm/dma.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
arch/arc/mm/dma.c +2 -1
@@ -92,7 +92,8 @@ static void *arc_dma_alloc(struct device
 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) ||

Patches currently in stable-queue which might be from [email protected] are

queue-4.7/arc-dma-fix-address-translation-in-arc_dma_free.patch