From 134f2c4af1b3e81671022c1095bfcdbf7a78a566 Mon Sep 17 00:00:00 2001 From: Janghyuck Kim Date: Wed, 28 Feb 2018 17:11:52 +0900 Subject: [PATCH] android: ion: add checking of returned page This patch added checking code to avoid invalid address access for cache operation. ion_page_pool_alloc_pages() might return NULL when alloc_pages() could not get enough pages as requested order, especially in high-order case. Change-Id: I7aa2bb08f32f523f5b76930b46c0f47d3457895b Signed-off-by: Janghyuck Kim --- drivers/staging/android/ion/ion_page_pool.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/android/ion/ion_page_pool.c b/drivers/staging/android/ion/ion_page_pool.c index 52d9d53bf85c..75997d653fab 100644 --- a/drivers/staging/android/ion/ion_page_pool.c +++ b/drivers/staging/android/ion/ion_page_pool.c @@ -98,7 +98,7 @@ struct page *ion_page_pool_alloc(struct ion_page_pool *pool, bool nozero) if (!page) { page = ion_page_pool_alloc_pages(pool, nozero); - if (!pool->cached) + if (page && !pool->cached) __flush_dcache_area(page_to_virt(page), 1 << (PAGE_SHIFT + pool->order)); } -- 2.20.1