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:   Fri, 11 Mar 2022 16:36:16 +0800
From:   Jiasheng Jiang <jiasheng@...as.ac.cn>
To:     rpeterso@...hat.com, agruenba@...hat.com
Cc:     cluster-devel@...hat.com, linux-kernel@...r.kernel.org,
        Jiasheng Jiang <jiasheng@...as.ac.cn>
Subject: [PATCH] gfs2: Add check for mempool_alloc

As the potential failure of mempool_alloc(),
it could return NULL pointer.
Therefore, it should be better to check it
in order to avoid the dereference of the NULL
pointer.

Fixes: e8c92ed76900 ("GFS2: Clean up log write code path")
Signed-off-by: Jiasheng Jiang <jiasheng@...as.ac.cn>
---
 fs/gfs2/log.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/fs/gfs2/log.c b/fs/gfs2/log.c
index f0ee3ff6f9a8..10dd09e9b0e4 100644
--- a/fs/gfs2/log.c
+++ b/fs/gfs2/log.c
@@ -837,6 +837,9 @@ void gfs2_write_log_header(struct gfs2_sbd *sdp, struct gfs2_jdesc *jd,
 		return;
 
 	page = mempool_alloc(gfs2_page_pool, GFP_NOIO);
+	if (!page)
+		return;
+
 	lh = page_address(page);
 	clear_page(lh);
 
-- 
2.25.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ