linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Linus Torvalds <torvalds@linux-foundation.org>
To: Al Viro <viro@ZenIV.linux.org.uk>
Cc: hooanon05@yahoo.co.jp,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [git pull] vfs patches, part 1
Date: Fri, 19 Jun 2009 17:29:06 -0700 (PDT)	[thread overview]
Message-ID: <alpine.LFD.2.01.0906191725060.10492@localhost.localdomain> (raw)
In-Reply-To: <8501.1245335415@jrobl>


Al? There does seem to be a leak there. 

		Linus

On Thu, 18 Jun 2009, hooanon05@yahoo.co.jp wrote:
> 
> Didn't you forget path_put() for the new member before returning in the
> middle of do_filp_open()?
> 
> 
> J. R. Okajima
> 
> ----------------------------------------------------------------------
> commit ccf163f67e7c4bf3890010a5a593eb62c3004a6a
> Author: J. R. Okajima <hooanon05@yahoo.co.jp>
> Date:   Thu Jun 18 23:26:34 2009 +0900
> 
>     vfs: nd->root in do_filp_open()
>     
>     commit 2a737871108de9ba8930f7650d549f1383767f8b
>     "Cache root in nameidata"
>     introduced a new member nd->root, but forgot to put it in
>     do_filp_open().
>     
>     Signed-off-by: J. R. Okajima <hooanon05@yahoo.co.jp>
> 
> diff --git a/fs/namei.c b/fs/namei.c
> index 527119a..5b961eb 100644
> --- a/fs/namei.c
> +++ b/fs/namei.c
> @@ -1698,8 +1698,11 @@ struct file *do_filp_open(int dfd, const char *pathname,
>  	if (error)
>  		return ERR_PTR(error);
>  	error = path_walk(pathname, &nd);
> -	if (error)
> +	if (error) {
> +		if (nd.root.mnt)
> +			path_put(&nd.root);
>  		return ERR_PTR(error);
> +	}
>  	if (unlikely(!audit_dummy_context()))
>  		audit_inode(pathname, nd.path.dentry);
>  
> @@ -1759,6 +1762,8 @@ do_last:
>  		}
>  		filp = nameidata_to_filp(&nd, open_flag);
>  		mnt_drop_write(nd.path.mnt);
> +		if (nd.root.mnt)
> +			path_put(&nd.root);
>  		return filp;
>  	}
>  
> @@ -1819,6 +1824,8 @@ ok:
>  	 */
>  	if (will_write)
>  		mnt_drop_write(nd.path.mnt);
> +	if (nd.root.mnt)
> +		path_put(&nd.root);
>  	return filp;
>  
>  exit_mutex_unlock:
> @@ -1859,6 +1866,8 @@ do_link:
>  		 * with "intent.open".
>  		 */
>  		release_open_intent(&nd);
> +		if (nd.root.mnt)
> +			path_put(&nd.root);
>  		return ERR_PTR(error);
>  	}
>  	nd.flags &= ~LOOKUP_PARENT;
> 

  reply	other threads:[~2009-06-20  0:29 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-06-12  1:45 [git pull] vfs patches, part 1 Al Viro
2009-06-12  3:13 ` Linus Torvalds
2009-06-12  3:38   ` Al Viro
2009-06-16 16:19 ` hooanon05
2009-06-16 17:31   ` Al Viro
2009-06-18 14:30 ` hooanon05
2009-06-20  0:29   ` Linus Torvalds [this message]
  -- strict thread matches above, loose matches on Subject: below --
2008-12-31  7:43 Al Viro
2008-12-31 17:21 ` Linus Torvalds
2008-12-31 17:31   ` Linus Torvalds
2008-12-31 17:41   ` Linus Torvalds
2008-12-31 20:43     ` Junio C Hamano
2008-12-31 23:10   ` Al Viro
2009-01-01  0:05     ` Linus Torvalds

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=alpine.LFD.2.01.0906191725060.10492@localhost.localdomain \
    --to=torvalds@linux-foundation.org \
    --cc=hooanon05@yahoo.co.jp \
    --cc=linux-kernel@vger.kernel.org \
    --cc=viro@ZenIV.linux.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).