From: Alexander Sapozhnikov <alsp705@gmail.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Alexander Sapozhnikov <alsp705@gmail.com>,
Uladzislau Rezki <urezki@gmail.com>,
Christoph Hellwig <hch@infradead.org>,
linux-mm@kvack.org, linux-kernel@vger.kernel.org,
lvc-project@linuxtesting.org
Subject: [PATCH] mm/vmalloc: fix unsafe dereference of potential null ptr in vmalloc_init()
Date: Fri, 17 Feb 2023 15:51:05 +0300 [thread overview]
Message-ID: <20230217125105.12385-1-alsp705@gmail.com> (raw)
Return value of a function 'kmem_cache_create' is dereferenced
at vmalloc.c:2444 without checking for null, but it is usually
checked for this function.
Found by Linux Verification Center (linuxtesting.org) with SVACE.
Signed-off-by: Alexander Sapozhnikov <alsp705@gmail.com>
---
mm/vmalloc.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/mm/vmalloc.c b/mm/vmalloc.c
index ca71de7c9d77..ed75dfd44b85 100644
--- a/mm/vmalloc.c
+++ b/mm/vmalloc.c
@@ -2426,6 +2426,8 @@ void __init vmalloc_init(void)
* Create the cache for vmap_area objects.
*/
vmap_area_cachep = KMEM_CACHE(vmap_area, SLAB_PANIC);
+ if (!vmap_area_cachep)
+ return;
for_each_possible_cpu(i) {
struct vmap_block_queue *vbq;
--
2.34.1
next reply other threads:[~2023-02-17 12:51 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-17 12:51 Alexander Sapozhnikov [this message]
2023-02-17 15:35 ` [PATCH] mm/vmalloc: fix unsafe dereference of potential null ptr in vmalloc_init() Christoph Hellwig
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=20230217125105.12385-1-alsp705@gmail.com \
--to=alsp705@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=hch@infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=lvc-project@linuxtesting.org \
--cc=urezki@gmail.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).