aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew Elble <aweits@rit.edu>2018-10-05 09:32:08 -0400
committerJ. Bruce Fields <bfields@redhat.com>2018-10-29 16:58:04 -0400
commitbd8d725078867cda250fe94b9c5a067b4a64ca74 (patch)
tree4c0f4fa0b06e38c6cbd8ad04f25aa5d5d453daaf
parent3ae2cefb613b00d613677c05ffa384b4f660f468 (diff)
nfsd: correctly decrement odstate refcount in error path
alloc_init_deleg() both allocates an nfs4_delegation, and bumps the refcount on odstate. So after this point, we need to put_clnt_odstate() and nfs4_put_stid() to not leave the odstate refcount inappropriately bumped. Signed-off-by: Andrew Elble <aweits@rit.edu> Reviewed-by: Jeff Layton <jlayton@kernel.org> Cc: stable@vger.kernel.org Signed-off-by: J. Bruce Fields <bfields@redhat.com>
-rw-r--r--fs/nfsd/nfs4state.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
index 07a57d024f95..f093fbe47133 100644
--- a/fs/nfsd/nfs4state.c
+++ b/fs/nfsd/nfs4state.c
@@ -4398,7 +4398,7 @@ nfs4_set_delegation(struct nfs4_client *clp, struct svc_fh *fh,
4398 4398
4399 fl = nfs4_alloc_init_lease(dp, NFS4_OPEN_DELEGATE_READ); 4399 fl = nfs4_alloc_init_lease(dp, NFS4_OPEN_DELEGATE_READ);
4400 if (!fl) 4400 if (!fl)
4401 goto out_stid; 4401 goto out_clnt_odstate;
4402 4402
4403 status = vfs_setlease(fp->fi_deleg_file, fl->fl_type, &fl, NULL); 4403 status = vfs_setlease(fp->fi_deleg_file, fl->fl_type, &fl, NULL);
4404 if (fl) 4404 if (fl)
@@ -4423,7 +4423,6 @@ out_unlock:
4423 vfs_setlease(fp->fi_deleg_file, F_UNLCK, NULL, (void **)&dp); 4423 vfs_setlease(fp->fi_deleg_file, F_UNLCK, NULL, (void **)&dp);
4424out_clnt_odstate: 4424out_clnt_odstate:
4425 put_clnt_odstate(dp->dl_clnt_odstate); 4425 put_clnt_odstate(dp->dl_clnt_odstate);
4426out_stid:
4427 nfs4_put_stid(&dp->dl_stid); 4426 nfs4_put_stid(&dp->dl_stid);
4428out_delegees: 4427out_delegees:
4429 put_deleg_file(fp); 4428 put_deleg_file(fp);