All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] mm/vmalloc.c: don't dereference possible NULL pointer in __vunmap.
@ 2018-12-28 17:10 Liviu Dudau
  0 siblings, 0 replies; only message in thread
From: Liviu Dudau @ 2018-12-28 17:10 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Chintan Pandya, Andrey Ryabinin, linux-mm, LKML, Liviu Dudau

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.

Fixes: f3c01d2f3ade ("mm: vmalloc: avoid racy handling of debugobjects
in vunmap")

Signed-off-by: Liviu Dudau <liviu@dudau.co.uk>
---
 mm/vmalloc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mm/vmalloc.c b/mm/vmalloc.c
index 871e41c55e239..806047d7fda3c 100644
--- a/mm/vmalloc.c
+++ b/mm/vmalloc.c
@@ -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);
-- 
2.20.1


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2018-12-28 17:15 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-12-28 17:10 [PATCH] mm/vmalloc.c: don't dereference possible NULL pointer in __vunmap Liviu Dudau

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.