ion: fix null page issue in alloc_buffer_page
authorJianxin Pan <jianxin.pan@amlogic.com>
Wed, 19 Sep 2018 11:08:29 +0000 (19:08 +0800)
committerJianxin Pan <jianxin.pan@amlogic.com>
Tue, 9 Oct 2018 02:25:37 +0000 (19:25 -0700)
PD#173802: Panic trace is
[<c011824c>] (dma_cache_maint_page) from [<c0118400>] (arm_dma_sync_single_for_device+0x58/0x60)
[<c0118400>] (arm_dma_sync_single_for_device) from [<c0118f24>] (arm_dma_sync_sg_for_device+0x60/0x8c)
[<c0118f24>] (arm_dma_sync_sg_for_device) from [<c07e52d0>] (ion_pages_sync_for_device+0x108/0x144)
[<c07e52d0>] (ion_pages_sync_for_device) from [<c07e71b4>] (ion_system_heap_allocate+0x38c/0x3bc)
[<c07e71b4>] (ion_system_heap_allocate) from [<c07e4c2c>] (ion_alloc+0x1e4/0x4d8)
[<c07e4c2c>] (ion_alloc) from [<c07e59f0>] (ion_ioctl+0x3b8/0x428)
[<c07e59f0>] (ion_ioctl) from [<c02a9368>] (do_vfs_ioctl+0xc0/0xa34)
[<c02a9368>] (do_vfs_ioctl) from [<c02a9d58>] (SyS_ioctl+0x7c/0x8c)
[<c02a9d58>] (SyS_ioctl) from [<c0108800>] (ret_fast_syscall+0x0/0x48)

Change-Id: I7e94ea05334693b6e9bfcc2400c9f7f3ff26736e
Signed-off-by: Jianxin Pan <jianxin.pan@amlogic.com>
drivers/staging/android/ion/ion_system_heap.c

index d270a424ecac1d49c137aa18901a6149b2f6d653..4364072b2e1b0ad12126d004821372186a210602 100644 (file)
@@ -75,7 +75,11 @@ static struct page *alloc_buffer_page(struct ion_system_heap *heap,
 
        page = ion_page_pool_alloc(pool);
 
+#ifdef CONFIG_AMLOGIC_MODIFY
+       if (cached && page)
+#else
        if (cached)
+#endif
                ion_pages_sync_for_device(NULL, page, PAGE_SIZE << order,
                                          DMA_BIDIRECTIONAL);
        return page;