ceph: fix dentry reference leak in ceph_encode_fh()
authorCyril Roelandt <tipecaml@gmail.com>
Tue, 18 Dec 2012 22:21:23 +0000 (14:21 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Tue, 18 Dec 2012 23:02:11 +0000 (15:02 -0800)
dput() was not called in the error path.

Signed-off-by: Cyril Roelandt <tipecaml@gmail.com>
Cc: Sage Weil <sage@inktank.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
fs/ceph/export.c

index 9349bb37a2fe68df93651e6afeb384468157edd2..ca3ab3f9ca70d87c6ab3a421c1e366b5b0d0fdbd 100644 (file)
@@ -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);