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]
Date:   Tue, 12 Jun 2018 11:38:12 +0800
From:   Zhouyang Jia <jiazhouyang09@...il.com>
To:     unlisted-recipients:; (no To-header on input)
Cc:     Zhouyang Jia <jiazhouyang09@...il.com>,
        Bob Peterson <rpeterso@...hat.com>,
        Andreas Gruenbacher <agruenba@...hat.com>,
        cluster-devel@...hat.com, linux-kernel@...r.kernel.org
Subject: [PATCH] gfs2: add error handling for kmem_cache_zalloc

When kmem_cache_zalloc fails, the lack of error-handling code may
cause unexpected results.

This patch adds error-handling code after calling kmem_cache_zalloc.

Signed-off-by: Zhouyang Jia <jiazhouyang09@...il.com>
---
 fs/gfs2/trans.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/fs/gfs2/trans.c b/fs/gfs2/trans.c
index 064c9a0..da81eb4 100644
--- a/fs/gfs2/trans.c
+++ b/fs/gfs2/trans.c
@@ -130,6 +130,9 @@ static struct gfs2_bufdata *gfs2_alloc_bufdata(struct gfs2_glock *gl,
 	struct gfs2_bufdata *bd;
 
 	bd = kmem_cache_zalloc(gfs2_bufdata_cachep, GFP_NOFS | __GFP_NOFAIL);
+	if (!bd)
+		return NULL;
+
 	bd->bd_bh = bh;
 	bd->bd_gl = gl;
 	bd->bd_ops = lops;
-- 
2.7.4

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ