ion: ion_system_heap: Fix null pointer dereference
The pointer returned from alloc_pages passed unchecked to
ion_pages_sync_for_device.
This patch checks the return for NULL.
Change-Id: I407efc73a1e1297f382a7926cc79542bde88d06d
Fixes: 2d4fdc7bde
("ion: Fix DMA operations for ARM64")
Signed-off-by: Prakash Gupta <guptap@codeaurora.org>
This commit is contained in:
parent
630218f710
commit
aadb9ac89c
1 changed files with 5 additions and 3 deletions
|
@ -2,7 +2,7 @@
|
||||||
* drivers/staging/android/ion/ion_system_heap.c
|
* drivers/staging/android/ion/ion_system_heap.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 2011 Google, Inc.
|
* Copyright (C) 2011 Google, Inc.
|
||||||
* Copyright (c) 2011-2016, The Linux Foundation. All rights reserved.
|
* Copyright (c) 2011-2017, The Linux Foundation. All rights reserved.
|
||||||
*
|
*
|
||||||
* This software is licensed under the terms of the GNU General Public
|
* This software is licensed under the terms of the GNU General Public
|
||||||
* License version 2, as published by the Free Software Foundation, and
|
* License version 2, as published by the Free Software Foundation, and
|
||||||
|
@ -123,9 +123,11 @@ static struct page *alloc_buffer_page(struct ion_system_heap *heap,
|
||||||
gfp_t gfp_mask = low_order_gfp_flags;
|
gfp_t gfp_mask = low_order_gfp_flags;
|
||||||
if (order)
|
if (order)
|
||||||
gfp_mask = high_order_gfp_flags;
|
gfp_mask = high_order_gfp_flags;
|
||||||
|
|
||||||
page = alloc_pages(gfp_mask, order);
|
page = alloc_pages(gfp_mask, order);
|
||||||
ion_pages_sync_for_device(dev, page, PAGE_SIZE << order,
|
if (page)
|
||||||
DMA_BIDIRECTIONAL);
|
ion_pages_sync_for_device(dev, page, PAGE_SIZE << order,
|
||||||
|
DMA_BIDIRECTIONAL);
|
||||||
}
|
}
|
||||||
if (!page)
|
if (!page)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
Loading…
Add table
Reference in a new issue