[PATCH] nfsd: fix file access refcount leak when nfsd4_truncate fails

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

 



We currently will get access to the file, and then call nfsd4_truncate
to (possibly) truncate it. If that operation fails though, then the
access references will never be released as the nfs4_ol_stateid is
never initialized.

Signed-off-by: Jeff Layton <jlayton@xxxxxxxxxxxxxxx>
---
 fs/nfsd/nfs4state.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
index 2204e1fe5725..3b19008c2978 100644
--- a/fs/nfsd/nfs4state.c
+++ b/fs/nfsd/nfs4state.c
@@ -3351,8 +3351,11 @@ nfsd4_process_open2(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nf
 		if (status)
 			goto out;
 		status = nfsd4_truncate(rqstp, current_fh, open);
-		if (status)
+		if (status) {
+			nfs4_file_put_access(fp,
+				nfs4_access_to_omode(open->op_share_access));
 			goto out;
+		}
 		stp = open->op_stp;
 		open->op_stp = NULL;
 		init_open_stateid(stp, fp, open);
-- 
1.9.3

--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[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