Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

nfsd: fix nfs4_file refcount leak in nfsd_get_dir_deleg()

Claude pointed out that there is a nfs4_file refcount leak in
nfsd_get_dir_deleg(). Ensure that the reference to "fp" is released
before returning.

Fixes: 8b99f6a8c116 ("nfsd: wire up GET_DIR_DELEGATION handling")
Cc: stable@vger.kernel.org
Cc: Chris Mason <clm@meta.com>
Signed-off-by: Jeff Layton <jlayton@kernel.org>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>

authored by

Jeff Layton and committed by
Chuck Lever
789477b8 27e383dd

+4 -1
+4 -1
fs/nfsd/nfs4state.c
··· 9516 9516 spin_unlock(&clp->cl_lock); 9517 9517 spin_unlock(&state_lock); 9518 9518 9519 - if (!status) 9519 + if (!status) { 9520 + put_nfs4_file(fp); 9520 9521 return dp; 9522 + } 9521 9523 9522 9524 /* Something failed. Drop the lease and clean up the stid */ 9523 9525 kernel_setlease(fp->fi_deleg_file->nf_file, F_UNLCK, NULL, (void **)&dp); ··· 9527 9525 nfs4_put_stid(&dp->dl_stid); 9528 9526 out_delegees: 9529 9527 put_deleg_file(fp); 9528 + put_nfs4_file(fp); 9530 9529 return ERR_PTR(status); 9531 9530 }