Skip to content

Commit

Permalink
ceph: fix leak of dentry in ceph_init_dentry() error path
Browse files Browse the repository at this point in the history
If we fail to allocate a ceph_dentry_info, don't leak the dn reference.

Signed-off-by: Sage Weil <sage@newdream.net>
  • Loading branch information
Sage Weil committed Jul 23, 2010
1 parent bc4fdca commit 8c69673
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion fs/ceph/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -1199,8 +1199,10 @@ int ceph_readdir_prepopulate(struct ceph_mds_request *req,
goto out;
}
err = ceph_init_dentry(dn);
if (err < 0)
if (err < 0) {
dput(dn);
goto out;
}
} else if (dn->d_inode &&
(ceph_ino(dn->d_inode) != vino.ino ||
ceph_snap(dn->d_inode) != vino.snap)) {
Expand Down

0 comments on commit 8c69673

Please sign in to comment.