lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220613102438.27723-1-renyu@nfschina.com>
Date:   Mon, 13 Jun 2022 18:24:38 +0800
From:   Ren Yu <renyu@...china.com>
To:     cl@...ux.com
Cc:     penberg@...nel.org, rientjes@...gle.com, iamjoonsoo.kim@....com,
        akpm@...ux-foundation.org, vbabka@...e.cz,
        roman.gushchin@...ux.dev, 42.hyeyoo@...il.com, linux-mm@...ck.org,
        linux-kernel@...r.kernel.org, liqiong@...china.com,
        qixu@...china.com, hukun@...china.com, yuzhe@...china.com,
        Ren Yu <renyu@...china.com>
Subject: [PATCH] mm: check the function kmalloc_slab return value

As the possible failure of the kmalloc_slab,
it should be better to check it.

Signed-off-by: Ren Yu <renyu@...china.com>
---
 mm/slab.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/mm/slab.c b/mm/slab.c
index f8cd00f4ba13..72135e555827 100644
--- a/mm/slab.c
+++ b/mm/slab.c
@@ -2064,6 +2064,8 @@ int __kmem_cache_create(struct kmem_cache *cachep, slab_flags_t flags)
 	if (OFF_SLAB(cachep)) {
 		cachep->freelist_cache =
 			kmalloc_slab(cachep->freelist_size, 0u);
+		if (unlikely(ZERO_OR_NULL_PTR(cachep->freelist_cache)))
+			return cachep->freelist_cache;
 	}
 
 	err = setup_cpu_cache(cachep, gfp);
-- 
2.11.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ