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:   Wed, 23 Mar 2022 16:00:03 +0800
From:   xkernel.wang@...mail.com
To:     trond.myklebust@...merspace.com, anna.schumaker@...app.com
Cc:     linux-nfs@...r.kernel.org, linux-kernel@...r.kernel.org,
        Xiaoke Wang <xkernel.wang@...mail.com>
Subject: [PATCH] NFS: check the return value of mempool_alloc()

From: Xiaoke Wang <xkernel.wang@...mail.com>

The check was first removed in 518662e ("NFS: fix usage of mempools.")
as the passed GFP flags is `GFP_NOIO`.
While now the flag is changed to `GFP_KERNEL` by 2b17d72 ("NFS: Clean
up writeback code"), so it is better to check it.

Signed-off-by: Xiaoke Wang <xkernel.wang@...mail.com>
---
 fs/nfs/write.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/fs/nfs/write.c b/fs/nfs/write.c
index eae9bf1..831fad9 100644
--- a/fs/nfs/write.c
+++ b/fs/nfs/write.c
@@ -106,8 +106,10 @@ static struct nfs_pgio_header *nfs_writehdr_alloc(void)
 {
 	struct nfs_pgio_header *p = mempool_alloc(nfs_wdata_mempool, GFP_KERNEL);
 
-	memset(p, 0, sizeof(*p));
-	p->rw_mode = FMODE_WRITE;
+	if (p) {
+		memset(p, 0, sizeof(*p));
+		p->rw_mode = FMODE_WRITE;
+	}
 	return p;
 }
 
-- 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ