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: <YcIjJ4jN3ax1rqaE@debian-BULLSEYE-live-builder-AMD64>
Date:   Tue, 21 Dec 2021 23:55:35 +0500
From:   Muhammad Usama Anjum <usama.anjum@...labora.com>
To:     "J. Bruce Fields" <bfields@...ldses.org>,
        Chuck Lever <chuck.lever@...cle.com>,
        Vasily Averin <vvs@...tuozzo.com>,
        "open list:KERNEL NFSD, SUNRPC, AND LOCKD SERVERS" 
        <linux-nfs@...r.kernel.org>,
        open list <linux-kernel@...r.kernel.org>
Cc:     usama.anjum@...labora.com, kernel@...labora.com,
        kernel-janitors@...r.kernel.org
Subject: [PATCH] nfs: check nf pointer for validity before use

Pointer nf can be NULL. It should be validated before dereferencing it.

Fixes: 8628027ba8 ("nfs: block notification on fs with its own ->lock")
Signed-off-by: Muhammad Usama Anjum <usama.anjum@...labora.com>
---
 fs/nfsd/nfs4state.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
index a526d4183348..bdd30988e615 100644
--- a/fs/nfsd/nfs4state.c
+++ b/fs/nfsd/nfs4state.c
@@ -6947,6 +6947,11 @@ nfsd4_lock(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
 		goto out;
 	}
 
+	if (!nf) {
+		status = nfserr_openmode;
+		goto out;
+	}
+
 	/*
 	 * Most filesystems with their own ->lock operations will block
 	 * the nfsd thread waiting to acquire the lock.  That leads to
@@ -6957,11 +6962,6 @@ nfsd4_lock(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
 	if (nf->nf_file->f_op->lock)
 		fl_flags &= ~FL_SLEEP;
 
-	if (!nf) {
-		status = nfserr_openmode;
-		goto out;
-	}
-
 	nbl = find_or_allocate_block(lock_sop, &fp->fi_fhandle, nn);
 	if (!nbl) {
 		dprintk("NFSD: %s: unable to allocate block!\n", __func__);
-- 
2.30.2

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ