From: Cyril Roelandt Date: Tue, 18 Dec 2012 22:21:23 +0000 (-0800) Subject: ceph: fix dentry reference leak in ceph_encode_fh() X-Git-Tag: upstream/snapshot3+hdmi~6012^2~44 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=f6af75dac3978d0b4d83939cb5d244b2a844820e;p=platform%2Fadaptation%2Frenesas_rcar%2Frenesas_kernel.git ceph: fix dentry reference leak in ceph_encode_fh() dput() was not called in the error path. Signed-off-by: Cyril Roelandt Cc: Sage Weil Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- 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);