* [PATCH] mm/vmalloc: fix unsafe dereference of potential null ptr in vmalloc_init()
@ 2023-02-17 12:51 Alexander Sapozhnikov
2023-02-17 15:35 ` Christoph Hellwig
0 siblings, 1 reply; 2+ messages in thread
From: Alexander Sapozhnikov @ 2023-02-17 12:51 UTC (permalink / raw)
To: Andrew Morton
Cc: Alexander Sapozhnikov, Uladzislau Rezki, Christoph Hellwig,
linux-mm, linux-kernel, lvc-project
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
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] mm/vmalloc: fix unsafe dereference of potential null ptr in vmalloc_init()
2023-02-17 12:51 [PATCH] mm/vmalloc: fix unsafe dereference of potential null ptr in vmalloc_init() Alexander Sapozhnikov
@ 2023-02-17 15:35 ` Christoph Hellwig
0 siblings, 0 replies; 2+ messages in thread
From: Christoph Hellwig @ 2023-02-17 15:35 UTC (permalink / raw)
To: Alexander Sapozhnikov
Cc: Andrew Morton, Uladzislau Rezki, Christoph Hellwig, linux-mm,
linux-kernel, lvc-project
On Fri, Feb 17, 2023 at 03:51:05PM +0300, Alexander Sapozhnikov wrote:
> 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.
I think that checker needs to learn about SLAB_PANIC..
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-02-17 15:35 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-17 12:51 [PATCH] mm/vmalloc: fix unsafe dereference of potential null ptr in vmalloc_init() Alexander Sapozhnikov
2023-02-17 15:35 ` Christoph Hellwig
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.