Skip to content

Commit

Permalink
ceph: fix dentry reference leak in ceph_encode_fh().
Browse files Browse the repository at this point in the history
dput() was not called in the error path.

Signed-off-by: Cyril Roelandt <tipecaml@gmail.com>
Reviewed-by: Alex Elder <elder@inktank.com>
  • Loading branch information
Cyril Roelandt authored and Alex Elder committed Dec 13, 2012
1 parent 22cddde commit cfc84c9
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion fs/ceph/export.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit cfc84c9

Please sign in to comment.