提交 b1948c62 编写于 作者: L Liviu Dudau 提交者: Xie XiuQi

mm/vmalloc.c: don't dereference possible NULL pointer in __vunmap()

mainline inclusion
from mainline-5.0-rc7
commit 22fa95e8071596d8442b07d4df2a49dbb7da7f94
category: bugfix
bugzilla: 10656
CVE: NA

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

find_vmap_area() can return a NULL pointer and we're going to dereference
it without checking it first.  Use the existing find_vm_area() function
which does exactly what we want and checks for the NULL pointer.

Link: http://lkml.kernel.org/r/20181228171009.22269-1-liviu@dudau.co.uk
Fixes: f3c01d2f ("mm: vmalloc: avoid racy handling of debugobjects in vunmap")
Signed-off-by: NLiviu Dudau <liviu@dudau.co.uk>
Reviewed-by: NAndrew Morton <akpm@linux-foundation.org>
Cc: Chintan Pandya <cpandya@codeaurora.org>
Cc: Andrey Ryabinin <aryabinin@virtuozzo.com>
Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: NStephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Nzhong jiang <zhongjiang@huawei.com>
Reviewed-by: NYang Yingliang <yangyingliang@huawei.com>
Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
上级 2f7601cb
......@@ -1505,7 +1505,7 @@ static void __vunmap(const void *addr, int deallocate_pages)
addr))
return;
area = find_vmap_area((unsigned long)addr)->vm;
area = find_vm_area(addr);
if (unlikely(!area)) {
WARN(1, KERN_ERR "Trying to vfree() nonexistent vm area (%p)\n",
addr);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册