Explorar o código

ceph: fix dentry reference leak in ceph_encode_fh().

dput() was not called in the error path.

Signed-off-by: Cyril Roelandt <tipecaml@gmail.com>
Reviewed-by: Alex Elder <elder@inktank.com>
Cyril Roelandt %!s(int64=12) %!d(string=hai) anos
pai
achega
cfc84c9f73
Modificáronse 1 ficheiros con 3 adicións e 1 borrados
  1. 3 1
      fs/ceph/export.c

+ 3 - 1
fs/ceph/export.c

@@ -56,13 +56,15 @@ static int ceph_encode_fh(struct inode *inode, u32 *rawfh, int *max_len,
 	struct ceph_nfs_confh *cfh = (void *)rawfh;
 	struct ceph_nfs_confh *cfh = (void *)rawfh;
 	int connected_handle_length = sizeof(*cfh)/4;
 	int connected_handle_length = sizeof(*cfh)/4;
 	int handle_length = sizeof(*fh)/4;
 	int handle_length = sizeof(*fh)/4;
-	struct dentry *dentry = d_find_alias(inode);
+	struct dentry *dentry;
 	struct dentry *parent;
 	struct dentry *parent;
 
 
 	/* don't re-export snaps */
 	/* don't re-export snaps */
 	if (ceph_snap(inode) != CEPH_NOSNAP)
 	if (ceph_snap(inode) != CEPH_NOSNAP)
 		return -EINVAL;
 		return -EINVAL;
 
 
+	dentry = d_find_alias(inode);
+
 	/* if we found an alias, generate a connectable fh */
 	/* if we found an alias, generate a connectable fh */
 	if (*max_len >= connected_handle_length && dentry) {
 	if (*max_len >= connected_handle_length && dentry) {
 		dout("encode_fh %p connectable\n", dentry);
 		dout("encode_fh %p connectable\n", dentry);