nfsd4: filehandle leak or error exit from fh_compose()
authorJ. Bruce Fields <bfields@citi.umich.edu>
Fri, 4 Sep 2009 15:59:32 +0000 (11:59 -0400)
committerJ. Bruce Fields <bfields@citi.umich.edu>
Fri, 4 Sep 2009 15:59:32 +0000 (11:59 -0400)
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>
fs/nfsd/nfsfh.c

index bce0b2bfbc61883ae9f4e65dcad0ec8f424cb13c..01965b2f3a7697e28598346e1fc32c6535a7fa2d 100644 (file)
@@ -557,8 +557,10 @@ fh_compose(struct svc_fh *fhp, struct svc_export *exp, struct dentry *dentry,
 
                if (inode)
                        _fh_update(fhp, exp, dentry);
-               if (fhp->fh_handle.fh_fileid_type == 255)
+               if (fhp->fh_handle.fh_fileid_type == 255) {
+                       fh_put(fhp);
                        return nfserr_opnotsupp;
+               }
        }
 
        return 0;