[PATCH AUTOSEL 5.4 061/175] staging: android: ion: use vmap instead of vm_map_ram

Sasha Levin sashal at kernel.org
Mon Jun 8 23:16:54 UTC 2020


From: Christoph Hellwig <hch at lst.de>

[ Upstream commit 5bf9917452112694b2c774465ee4dbe441c84b77 ]

vm_map_ram can keep mappings around after the vm_unmap_ram.  Using that
with non-PAGE_KERNEL mappings can lead to all kinds of aliasing issues.

Signed-off-by: Christoph Hellwig <hch at lst.de>
Signed-off-by: Andrew Morton <akpm at linux-foundation.org>
Acked-by: Greg Kroah-Hartman <gregkh at linuxfoundation.org>
Acked-by: Peter Zijlstra (Intel) <peterz at infradead.org>
Cc: Christian Borntraeger <borntraeger at de.ibm.com>
Cc: Christophe Leroy <christophe.leroy at c-s.fr>
Cc: Daniel Vetter <daniel.vetter at ffwll.ch>
Cc: David Airlie <airlied at linux.ie>
Cc: Gao Xiang <xiang at kernel.org>
Cc: Haiyang Zhang <haiyangz at microsoft.com>
Cc: Johannes Weiner <hannes at cmpxchg.org>
Cc: "K. Y. Srinivasan" <kys at microsoft.com>
Cc: Laura Abbott <labbott at redhat.com>
Cc: Mark Rutland <mark.rutland at arm.com>
Cc: Michael Kelley <mikelley at microsoft.com>
Cc: Minchan Kim <minchan at kernel.org>
Cc: Nitin Gupta <ngupta at vflare.org>
Cc: Robin Murphy <robin.murphy at arm.com>
Cc: Sakari Ailus <sakari.ailus at linux.intel.com>
Cc: Stephen Hemminger <sthemmin at microsoft.com>
Cc: Sumit Semwal <sumit.semwal at linaro.org>
Cc: Wei Liu <wei.liu at kernel.org>
Cc: Benjamin Herrenschmidt <benh at kernel.crashing.org>
Cc: Catalin Marinas <catalin.marinas at arm.com>
Cc: Heiko Carstens <heiko.carstens at de.ibm.com>
Cc: Paul Mackerras <paulus at ozlabs.org>
Cc: Vasily Gorbik <gor at linux.ibm.com>
Cc: Will Deacon <will at kernel.org>
Link: http://lkml.kernel.org/r/20200414131348.444715-4-hch@lst.de
Signed-off-by: Linus Torvalds <torvalds at linux-foundation.org>
Signed-off-by: Sasha Levin <sashal at kernel.org>
---
 drivers/staging/android/ion/ion_heap.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/android/ion/ion_heap.c b/drivers/staging/android/ion/ion_heap.c
index 473b465724f1..0755b11348ed 100644
--- a/drivers/staging/android/ion/ion_heap.c
+++ b/drivers/staging/android/ion/ion_heap.c
@@ -99,12 +99,12 @@ int ion_heap_map_user(struct ion_heap *heap, struct ion_buffer *buffer,
 
 static int ion_heap_clear_pages(struct page **pages, int num, pgprot_t pgprot)
 {
-	void *addr = vm_map_ram(pages, num, -1, pgprot);
+	void *addr = vmap(pages, num, VM_MAP, pgprot);
 
 	if (!addr)
 		return -ENOMEM;
 	memset(addr, 0, PAGE_SIZE * num);
-	vm_unmap_ram(addr, num);
+	vunmap(addr);
 
 	return 0;
 }
-- 
2.25.1



More information about the dri-devel mailing list