linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] vfs: fix reference leak in d_prune_aliases()
@ 2014-11-19  7:50 Yan, Zheng
  2014-11-19  8:24 ` Al Viro
  0 siblings, 1 reply; 2+ messages in thread
From: Yan, Zheng @ 2014-11-19  7:50 UTC (permalink / raw)
  To: linux-fsdevel; +Cc: viro, Yan, Zheng

Signed-off-by: Yan, Zheng <zyan@redhat.com>
---
 fs/dcache.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/fs/dcache.c b/fs/dcache.c
index 3ffef7f..5bc72b0 100644
--- a/fs/dcache.c
+++ b/fs/dcache.c
@@ -778,6 +778,7 @@ restart:
 			struct dentry *parent = lock_parent(dentry);
 			if (likely(!dentry->d_lockref.count)) {
 				__dentry_kill(dentry);
+				dput(parent);
 				goto restart;
 			}
 			if (parent)
-- 
1.9.3


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] vfs: fix reference leak in d_prune_aliases()
  2014-11-19  7:50 [PATCH] vfs: fix reference leak in d_prune_aliases() Yan, Zheng
@ 2014-11-19  8:24 ` Al Viro
  0 siblings, 0 replies; 2+ messages in thread
From: Al Viro @ 2014-11-19  8:24 UTC (permalink / raw)
  To: Yan, Zheng; +Cc: linux-fsdevel

On Wed, Nov 19, 2014 at 03:50:34PM +0800, Yan, Zheng wrote:
> Signed-off-by: Yan, Zheng <zyan@redhat.com>
> ---
>  fs/dcache.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/fs/dcache.c b/fs/dcache.c
> index 3ffef7f..5bc72b0 100644
> --- a/fs/dcache.c
> +++ b/fs/dcache.c
> @@ -778,6 +778,7 @@ restart:
>  			struct dentry *parent = lock_parent(dentry);
>  			if (likely(!dentry->d_lockref.count)) {
>  				__dentry_kill(dentry);
> +				dput(parent);
>  				goto restart;
>  			}
>  			if (parent)

Good catch...  Applied, will push to Linus.  I'm putting the following as
commit message:

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.

Is the above OK with you?

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-11-19  8:24 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-11-19  7:50 [PATCH] vfs: fix reference leak in d_prune_aliases() Yan, Zheng
2014-11-19  8:24 ` Al Viro

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).