diff mbox

[3/3] ceph: fix dentry reference leak in ceph_encode_fh().

Message ID 1352666971-13551-4-git-send-email-tipecaml@gmail.com (mailing list archive)
State New, archived
Headers show

Commit Message

Cyril Roelandt Nov. 11, 2012, 8:49 p.m. UTC
dput() was not called in the error path.

Signed-off-by: Cyril Roelandt <tipecaml@gmail.com>
---
 fs/ceph/export.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Alex Elder Nov. 20, 2012, 4:21 p.m. UTC | #1
On 11/11/2012 02:49 PM, Cyril Roelandt wrote:
> dput() was not called in the error path.
> 
> Signed-off-by: Cyril Roelandt <tipecaml@gmail.com>

This looks good, thanks a lot.  I'll apply it.

Reviewed-by: Alex Elder <elder@inktank.com>

> ---
>  fs/ceph/export.c |    4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/fs/ceph/export.c b/fs/ceph/export.c
> index 9349bb3..ca3ab3f 100644
> --- a/fs/ceph/export.c
> +++ b/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;
>  	int connected_handle_length = sizeof(*cfh)/4;
>  	int handle_length = sizeof(*fh)/4;
> -	struct dentry *dentry = d_find_alias(inode);
> +	struct dentry *dentry;
>  	struct dentry *parent;
>  
>  	/* don't re-export snaps */
>  	if (ceph_snap(inode) != CEPH_NOSNAP)
>  		return -EINVAL;
>  
> +	dentry = d_find_alias(inode);
> +
>  	/* if we found an alias, generate a connectable fh */
>  	if (*max_len >= connected_handle_length && dentry) {
>  		dout("encode_fh %p connectable\n", dentry);
> 

--
To unsubscribe from this list: send the line "unsubscribe ceph-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/fs/ceph/export.c b/fs/ceph/export.c
index 9349bb3..ca3ab3f 100644
--- a/fs/ceph/export.c
+++ b/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;
 	int connected_handle_length = sizeof(*cfh)/4;
 	int handle_length = sizeof(*fh)/4;
-	struct dentry *dentry = d_find_alias(inode);
+	struct dentry *dentry;
 	struct dentry *parent;
 
 	/* don't re-export snaps */
 	if (ceph_snap(inode) != CEPH_NOSNAP)
 		return -EINVAL;
 
+	dentry = d_find_alias(inode);
+
 	/* if we found an alias, generate a connectable fh */
 	if (*max_len >= connected_handle_length && dentry) {
 		dout("encode_fh %p connectable\n", dentry);