Skip to content

Commit

Permalink
vfs: fix reference leak in d_prune_aliases()
Browse files Browse the repository at this point in the history
In "d_prune_alias(): just lock the parent and call __dentry_kill()" the old
dget + d_drop + dput has been replaced with lock_parent + __dentry_kill;
unfortunately, dput() does more than just killing dentry - it also drops the
reference to parent.  New variant leaks that reference and needs dput(parent)
after killing the child off.

Signed-off-by: Yan, Zheng <zyan@redhat.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
  • Loading branch information
Yan, Zheng authored and Al Viro committed Nov 19, 2014
1 parent ad0eab9 commit 4a7795d
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions fs/dcache.c
Original file line number Diff line number Diff line change
Expand Up @@ -778,6 +778,7 @@ void d_prune_aliases(struct inode *inode)
struct dentry *parent = lock_parent(dentry);
if (likely(!dentry->d_lockref.count)) {
__dentry_kill(dentry);
dput(parent);
goto restart;
}
if (parent)
Expand Down

0 comments on commit 4a7795d

Please sign in to comment.