Re: [patch 1/9] procfs: Move /proc/pid/fd[info] handling code tofd.[ch]

From: Al Viro
Date: Sat Aug 25 2012 - 15:12:24 EST


On Sat, Aug 25, 2012 at 10:58:29PM +0400, Cyrill Gorcunov wrote:
> On Sat, Aug 25, 2012 at 06:55:04PM +0100, Al Viro wrote:
> > > Well, this could be simplified indeed, if I understand you correctly
> > > you propose just save f_mode in flexible array and use it instead
> > > of struct file, right? (which will require to rewrite code a bit)
> >
> > Yes. FWIW, proc_fill_cache() is really atrocious ;-/ Not to mention
>
> OK, thanks. I'm putting this cleanup task in my big todo list. Hope I'll
> manage on the next week with it.
>
> > anything else, if we ever get a negative dentry there, we have a dentry
> > leak. I don't think it's possible in practice, but... Furthermore,
>
> could you please elaborate, you mean this string?

I mean that if we get to that if (... || !child->d_inode) and end up
evaluating the last part at all, we have acquired a reference to that
struct dentry. And if that last part ends up being true (i.e. if it's
a negative dentry), we'll return from function without having dropped
the reference we'd acquired.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/