All of lore.kernel.org
 help / color / mirror / Atom feed
From: Liviu Dudau <liviu@dudau.co.uk>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Chintan Pandya <cpandya@codeaurora.org>,
	Andrey Ryabinin <aryabinin@virtuozzo.com>,
	linux-mm@kvack.org, LKML <linux-kernel@vger.kernel.org>,
	Liviu Dudau <liviu@dudau.co.uk>
Subject: [PATCH] mm/vmalloc.c: don't dereference possible NULL pointer in __vunmap.
Date: Fri, 28 Dec 2018 17:10:09 +0000	[thread overview]
Message-ID: <20181228171009.22269-1-liviu@dudau.co.uk> (raw)

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


                 reply	other threads:[~2018-12-28 17:15 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20181228171009.22269-1-liviu@dudau.co.uk \
    --to=liviu@dudau.co.uk \
    --cc=akpm@linux-foundation.org \
    --cc=aryabinin@virtuozzo.com \
    --cc=cpandya@codeaurora.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.