From: Trond Myklebust <trond.myklebust@fys.uio.no>
To: Andrew Morton <akpm@osdl.org>
Cc: dev@sw.ru, linux-kernel@vger.kernel.org, kuznet@ms2.inr.ac.ru,
devel@openvz.org
Subject: Re: [PATCH] struct file leakage
Date: Tue, 11 Jul 2006 20:26:02 -0400 [thread overview]
Message-ID: <1152663962.5681.58.camel@lade.trondhjem.org> (raw)
In-Reply-To: <20060711163254.5ac8941b.akpm@osdl.org>
On Tue, 2006-07-11 at 16:32 -0700, Andrew Morton wrote:
> Trond Myklebust <trond.myklebust@fys.uio.no> wrote:
> >
> > > > - if (error)
> > > > + if (error) {
> > > > + /* Does someone understand code flow here? Or it is only
> > > > + * me so stupid? Anathema to whoever designed this non-sense
> > > > + * with "intent.open".
> > > > + */
> > > > + if (!IS_ERR(nd->intent.open.file))
> > > > + release_open_intent(nd);
> > > > return error;
> > > > + }
> > > > nd->flags &= ~LOOKUP_PARENT;
> > > > if (nd->last_type == LAST_BIND)
> > > > goto ok;
> > > >
> > >
> > > It's good to have some more Alexeycomments in the tree.
> > >
> > > I wonder if we're also needing a path_release() here. And if not, whether
> > > it is still safe to run release_open_intent() against this nameidata?
> > >
> > > Hopefully Trond can recall what's going on in there...
> >
> > The patch looks correct, except that I believe we can skip the IS_ERR()
> > test there: if we're following links then we presumably have not tried
> > to open any files yet, so the call to release_open_intent(nd) can be
> > made unconditional.
>
> Sorry, but phrases like "looks correct" and "I believe" don't inspire
> confidence. (Although what you say looks correct ;)) Are you sure?
We do need the call to release_open_intent(), since otherwise we will
leak a struct file. The question is whether we can optimise away the
IS_ERR() test. In my opinion, we can.
> And do we also need a path_release(nd) in there?
No. do_follow_link() should release the path for us on error. Replacing
with a 'goto exit' would therefore be a mistake.
Cheers,
Trond
next prev parent reply other threads:[~2006-07-12 0:26 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-07-10 9:05 Kirill Korotaev
2006-07-10 10:05 ` Andrew Morton
2006-07-10 10:16 ` Alexey Kuznetsov
2006-07-11 12:04 ` Trond Myklebust
2006-07-11 23:32 ` Andrew Morton
2006-07-12 0:26 ` Trond Myklebust [this message]
2006-07-10 11:56 ` Eric W. Biederman
-- strict thread matches above, loose matches on Subject: below --
2006-07-10 9:05 Kirill Korotaev
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=1152663962.5681.58.camel@lade.trondhjem.org \
--to=trond.myklebust@fys.uio.no \
--cc=akpm@osdl.org \
--cc=dev@sw.ru \
--cc=devel@openvz.org \
--cc=kuznet@ms2.inr.ac.ru \
--cc=linux-kernel@vger.kernel.org \
/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
all inboxes | Powered by JetHome®