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

nfsd4: filehandle leak or error exit from fh_compose()

A number of callers (nfsd4_encode_fattr(), at least) don't bother to
release the filehandle returned to fh_compose() if fh_compose() returns
an error. So, modify fh_compose() to release the filehandle before
returning an error.

Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>

+3 -1
+3 -1
fs/nfsd/nfsfh.c
··· 557 557 558 558 if (inode) 559 559 _fh_update(fhp, exp, dentry); 560 - if (fhp->fh_handle.fh_fileid_type == 255) 560 + if (fhp->fh_handle.fh_fileid_type == 255) { 561 + fh_put(fhp); 561 562 return nfserr_opnotsupp; 563 + } 562 564 } 563 565 564 566 return 0;