Commit d3e9ce00 authored by Jianqun Xu's avatar Jianqun Xu Committed by Yang Yingliang
Browse files

mm/cma.c: fix NULL pointer dereference when cma could not be activated



mainline inclusion
from mainline-v5.9-rc1
commit 835832ba
category: bugfix
bugzilla: 41397
CVE: NA

-------------------------------------------------

In some case the cma area could not be activated, but the cma_alloc be
used under this case, then the kernel will crash caused by NULL pointer
dereference.

Add bitmap valid check in cma_alloc to avoid this issue.

Signed-off-by: default avatarJianqun Xu <jay.xu@rock-chips.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Reviewed-by: default avatarDavid Hildenbrand <david@redhat.com>
Link: http://lkml.kernel.org/r/20200615010123.15596-1-jay.xu@rock-chips.com


Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: default avatarLiu Shixin <liushixin2@huawei.com>
Reviewed-by: default avatarChen Wandun <chenwandun@huawei.com>
Signed-off-by: default avatarYang Yingliang <yangyingliang@huawei.com>
parent 3b3af8a6
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment