[PATCH 1/2] NFSD: Prevent lock/unlock imbalance in do_nfsd_create()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The "out" label invokes fh_unlock() and fh_drop_write(). However, at
the top of do_nfsd_create(), we haven't yet invoked fh_want_write()
or fh_lock_nested().

The "!flen" check is unnecessary because lookup_one_common() already
does that check. See commit 12391d07230e ("nfsd: remove redundant
zero-length check from create")

Cc: <stable@xxxxxxxxxxxxxxx>
Signed-off-by: Chuck Lever <chuck.lever@xxxxxxxxxx>
---
 fs/nfsd/vfs.c |   10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/fs/nfsd/vfs.c b/fs/nfsd/vfs.c
index 166eb0ba3e71..f54da591a5bf 100644
--- a/fs/nfsd/vfs.c
+++ b/fs/nfsd/vfs.c
@@ -1389,24 +1389,20 @@ do_nfsd_create(struct svc_rqst *rqstp, struct svc_fh *fhp,
 	int		host_err;
 	__u32		v_mtime=0, v_atime=0;
 
-	err = nfserr_perm;
-	if (!flen)
-		goto out;
-	err = nfserr_exist;
 	if (isdotent(fname, flen))
-		goto out;
+		return nfserr_exist;
 	if (!(iap->ia_valid & ATTR_MODE))
 		iap->ia_mode = 0;
 	err = fh_verify(rqstp, fhp, S_IFDIR, NFSD_MAY_EXEC);
 	if (err)
-		goto out;
+		return err;
 
 	dentry = fhp->fh_dentry;
 	dirp = d_inode(dentry);
 
 	host_err = fh_want_write(fhp);
 	if (host_err)
-		goto out_nfserr;
+		return nfserrno(host_err);
 
 	fh_lock_nested(fhp, I_MUTEX_PARENT);
 




[Index of Archives]     [Linux Filesystem Development]     [Linux USB Development]     [Linux Media Development]     [Video for Linux]     [Linux NILFS]     [Linux Audio Users]     [Yosemite Info]     [Linux SCSI]

  Powered by Linux