From 0f9dbcc5e14a7e6fd772ee87fc64c9c8c4e4f133 Mon Sep 17 00:00:00 2001 From: Vijayanand Jitta Date: Wed, 7 Apr 2021 11:26:57 +0530 Subject: [PATCH] ion: Check for PagePrivate in free_buffer_page There is a possibility of non secure pages getting added to secure pool one such case is in secure system heap alloc failure path, Fix this by checking if page is private before selecting the pool. Change-Id: I5d7e94040fcbdb7aa2621eb537c8bc249887fc4f Signed-off-by: Vijayanand Jitta --- drivers/staging/android/ion/heaps/ion_msm_system_heap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/android/ion/heaps/ion_msm_system_heap.c b/drivers/staging/android/ion/heaps/ion_msm_system_heap.c index f93f62b0a73b..fcec586274ac 100644 --- a/drivers/staging/android/ion/heaps/ion_msm_system_heap.c +++ b/drivers/staging/android/ion/heaps/ion_msm_system_heap.c @@ -143,7 +143,7 @@ void free_buffer_page(struct ion_msm_system_heap *heap, if (!(buffer->flags & ION_FLAG_POOL_FORCE_ALLOC)) { struct ion_msm_page_pool *pool; - if (vmid > 0) + if (vmid > 0 && PagePrivate(page)) pool = heap->secure_pools[vmid][order_to_index(order)]; else if (cached) pool = heap->cached_pools[order_to_index(order)];