Skip to content

Commit

Permalink
mm/vmalloc.c: don't dereference possible NULL pointer in __vunmap()
Browse files Browse the repository at this point in the history
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/[email protected]
Fixes: f3c01d2 ("mm: vmalloc: avoid racy handling of debugobjects in vunmap")
Signed-off-by: Liviu Dudau <[email protected]>
Reviewed-by: Andrew Morton <[email protected]>
Cc: Chintan Pandya <[email protected]>
Cc: Andrey Ryabinin <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
dliviu authored and torvalds committed Mar 6, 2019
1 parent abd02ac commit 6ade203
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion mm/vmalloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 6ade203

Please sign in to comment.