浏览代码

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>
J. Bruce Fields 15 年之前
父节点
当前提交
1be10a88ca
共有 1 个文件被更改,包括 3 次插入1 次删除
  1. 3 1
      fs/nfsd/nfsfh.c

+ 3 - 1
fs/nfsd/nfsfh.c

@@ -557,8 +557,10 @@ fh_compose(struct svc_fh *fhp, struct svc_export *exp, struct dentry *dentry,
 
 
 		if (inode)
 		if (inode)
 			_fh_update(fhp, exp, dentry);
 			_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 nfserr_opnotsupp;
+		}
 	}
 	}
 
 
 	return 0;
 	return 0;