All of lore.kernel.org
 help / color / mirror / Atom feed
From: ebiederm@xmission.com (Eric W. Biederman)
To: Al Viro <viro@ZenIV.linux.org.uk>
Cc: linux-fsdevel@vger.kernel.org,
	Andrew Morton <akpm@linux-foundation.org>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] vfs: Don't leak a path when get_empty_filp in dentry_open
Date: Thu, 16 Jan 2014 16:17:27 -0800	[thread overview]
Message-ID: <87eh47v4vc.fsf@xmission.com> (raw)
In-Reply-To: <20140116235925.GY10323@ZenIV.linux.org.uk> (Al Viro's message of "Thu, 16 Jan 2014 23:59:25 +0000")

Al Viro <viro@ZenIV.linux.org.uk> writes:

> On Thu, Jan 16, 2014 at 03:45:38PM -0800, Eric W. Biederman wrote:
>> 
>> Normally in dentry_open the passed in path is placed on the new filp
>> removing the caller from needing to worry about it.  In the rare case
>> that we can not allocate a filp the path is not consumed.  None of the
>> callers of dentry_open call path_put in their error handling when
>> dentry_open fails so call path_put for them on error and keep everyone's
>> error handling simple.
>
> You are misreading that code.  _No_ path in dentry_open() drops that
> sucker, no matter whether we succeed or fail.  do_dentry_open() grabs
> an extra reference on success, so those fput() on other failure exits
> just balance that.

Yep you are right.  My mistake.  The weird code flow tricked me.

Eric

      reply	other threads:[~2014-01-17  0:17 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-16 23:45 [PATCH] vfs: Don't leak a path when get_empty_filp in dentry_open Eric W. Biederman
2014-01-16 23:59 ` Al Viro
2014-01-17  0:17   ` Eric W. Biederman [this message]

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=87eh47v4vc.fsf@xmission.com \
    --to=ebiederm@xmission.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.