From: Christoph Hellwig <h...@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 <h...@lst.de>
Signed-off-by: Andrew Morton <a...@linux-foundation.org>
Acked-by: Greg Kroah-Hartman <gre...@linuxfoundation.org>
Acked-by: Peter Zijlstra (Intel) <pet...@infradead.org>
Cc: Christian Borntraeger <borntrae...@de.ibm.com>
Cc: Christophe Leroy <christophe.le...@c-s.fr>
Cc: Daniel Vetter <daniel.vet...@ffwll.ch>
Cc: David Airlie <airl...@linux.ie>
Cc: Gao Xiang <xi...@kernel.org>
Cc: Haiyang Zhang <haiya...@microsoft.com>
Cc: Johannes Weiner <han...@cmpxchg.org>
Cc: "K. Y. Srinivasan" <k...@microsoft.com>
Cc: Laura Abbott <labb...@redhat.com>
Cc: Mark Rutland <mark.rutl...@arm.com>
Cc: Michael Kelley <mikel...@microsoft.com>
Cc: Minchan Kim <minc...@kernel.org>
Cc: Nitin Gupta <ngu...@vflare.org>
Cc: Robin Murphy <robin.mur...@arm.com>
Cc: Sakari Ailus <sakari.ai...@linux.intel.com>
Cc: Stephen Hemminger <sthem...@microsoft.com>
Cc: Sumit Semwal <sumit.sem...@linaro.org>
Cc: Wei Liu <wei....@kernel.org>
Cc: Benjamin Herrenschmidt <b...@kernel.crashing.org>
Cc: Catalin Marinas <catalin.mari...@arm.com>
Cc: Heiko Carstens <heiko.carst...@de.ibm.com>
Cc: Paul Mackerras <pau...@ozlabs.org>
Cc: Vasily Gorbik <g...@linux.ibm.com>
Cc: Will Deacon <w...@kernel.org>
Link: http://lkml.kernel.org/r/20200414131348.444715-4-...@lst.de
Signed-off-by: Linus Torvalds <torva...@linux-foundation.org>
Signed-off-by: Sasha Levin <sas...@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 c2a7cb95725b..4fc5de13582d 100644
--- a/drivers/staging/android/ion/ion_heap.c
+++ b/drivers/staging/android/ion/ion_heap.c
@@ -105,12 +105,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

Reply via email to