summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVinayak Menon <vinmenon@codeaurora.org>2019-01-31 20:47:07 +0530
committerGerrit - the friendly Code Review server <code-review@localhost>2019-03-19 20:46:51 -0700
commitda44b5842fe565126f651dfabbe4bd72af8be883 (patch)
tree55e2f0ec52bb1351ac1e3b144d7461c611fe9284
parent0a0147a03eea011894e164fefda56e442b005389 (diff)
ion: fix system secure force alloc
Even when ION_FLAG_POOL_FORCE_ALLOC is set for secure alloc, alloc_from_pool_preferred tries to get the pages from pool first. In case if it enters split_page_from_secure_pool, free_buffer_page can end up calling __free_pages on the page from pool which is hyp assigned, resulting in issues for e.g. a fault if page poisoning is enabled. Change-Id: I68759dc17551a5705693506a5c137977d429fe36 Signed-off-by: Vinayak Menon <vinmenon@codeaurora.org>
-rw-r--r--drivers/staging/android/ion/ion_system_heap.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/drivers/staging/android/ion/ion_system_heap.c b/drivers/staging/android/ion/ion_system_heap.c
index 0d851fffa082..d7bfa5ac943b 100644
--- a/drivers/staging/android/ion/ion_system_heap.c
+++ b/drivers/staging/android/ion/ion_system_heap.c
@@ -2,7 +2,7 @@
* drivers/staging/android/ion/ion_system_heap.c
*
* Copyright (C) 2011 Google, Inc.
- * Copyright (c) 2011-2018, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2011-2019, The Linux Foundation. All rights reserved.
*
* This software is licensed under the terms of the GNU General Public
* License version 2, as published by the Free Software Foundation, and
@@ -270,6 +270,9 @@ static struct page_info *alloc_from_pool_preferred(
struct page_info *info;
int i;
+ if (buffer->flags & ION_FLAG_POOL_FORCE_ALLOC)
+ goto force_alloc;
+
info = kmalloc(sizeof(*info), GFP_KERNEL);
if (!info)
return NULL;
@@ -301,6 +304,7 @@ static struct page_info *alloc_from_pool_preferred(
}
kfree(info);
+force_alloc:
return alloc_largest_available(heap, buffer, size, max_order);
}