summaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorCyril Roelandt <tipecaml@gmail.com>2012-12-18 23:21:23 +0100
committerLinus Torvalds <torvalds@linux-foundation.org>2012-12-19 00:02:11 +0100
commitf6af75dac3978d0b4d83939cb5d244b2a844820e (patch)
tree5d73ddf996763783ad8e65d6754cfba0cd478af6 /fs
parentarch/x86/platform/iris/iris.c: register a platform device and a platform driver (diff)
downloadlinux-f6af75dac3978d0b4d83939cb5d244b2a844820e.tar.xz
linux-f6af75dac3978d0b4d83939cb5d244b2a844820e.zip
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> Cc: Sage Weil <sage@inktank.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs')
-rw-r--r--fs/ceph/export.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/fs/ceph/export.c b/fs/ceph/export.c
index 9349bb37a2fe..ca3ab3f9ca70 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);