From: Jeff Layton Date: Sat, 13 Dec 2014 14:11:39 +0000 (-0500) Subject: nfsd: fix fi_delegees leak when fi_had_conflict returns true X-Git-Tag: v3.18.3~45 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=bff467fabe9ef86b891bb8968e7f2883c9e46515;p=platform%2Fkernel%2Flinux-stable.git nfsd: fix fi_delegees leak when fi_had_conflict returns true commit 94ae1db226a5bcbb48372d81161f084c9e283fd8 upstream. Currently, nfs4_set_delegation takes a reference to an existing delegation and then checks to see if there is a conflict. If there is one, then it doesn't release that reference. Change the code to take the reference after the check and only if there is no conflict. Signed-off-by: Jeff Layton Signed-off-by: J. Bruce Fields Signed-off-by: Greg Kroah-Hartman --- diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c index d504cd6927f8..d66e3ad1de48 100644 --- a/fs/nfsd/nfs4state.c +++ b/fs/nfsd/nfs4state.c @@ -3890,11 +3890,11 @@ nfs4_set_delegation(struct nfs4_client *clp, struct svc_fh *fh, status = nfs4_setlease(dp); goto out; } - atomic_inc(&fp->fi_delegees); if (fp->fi_had_conflict) { status = -EAGAIN; goto out_unlock; } + atomic_inc(&fp->fi_delegees); hash_delegation_locked(dp, fp); status = 0; out_unlock: