summaryrefslogtreecommitdiffstats
path: root/mm
diff options
context:
space:
mode:
authorLiviu Dudau <liviu@dudau.co.uk>2019-03-05 15:42:54 -0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2020-06-03 08:12:15 +0200
commitce63bbf57dec45da32623e5e9e246de86a2f4481 (patch)
tree212ea2ddf4cb4b0877a7bda28e10d30cb0116df2 /mm
parent9c37f759a9e44041e9d4f206a4f1955ac48956bb (diff)
downloadlinux-stable-ce63bbf57dec45da32623e5e9e246de86a2f4481.tar.gz
linux-stable-ce63bbf57dec45da32623e5e9e246de86a2f4481.tar.bz2
linux-stable-ce63bbf57dec45da32623e5e9e246de86a2f4481.zip
mm/vmalloc.c: don't dereference possible NULL pointer in __vunmap()
commit 6ade20327dbb808882888ed8ccded71e93067cf9 upstream. 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: f3c01d2f3ade ("mm: vmalloc: avoid racy handling of debugobjects in vunmap") Signed-off-by: Liviu Dudau <liviu@dudau.co.uk> Reviewed-by: Andrew Morton <akpm@linux-foundation.org> Cc: Chintan Pandya <cpandya@codeaurora.org> Cc: Andrey Ryabinin <aryabinin@virtuozzo.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Cc: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'mm')
-rw-r--r--mm/vmalloc.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/mm/vmalloc.c b/mm/vmalloc.c
index c9e6fc6a5fef..5dafd41d0732 100644
--- a/mm/vmalloc.c
+++ b/mm/vmalloc.c
@@ -1464,7 +1464,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);