[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YvzUS/7bd1mm6c/V@kroah.com>
Date: Wed, 17 Aug 2022 13:43:07 +0200
From: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
To: Christian Brauner <brauner@...nel.org>
Cc: Al Viro <viro@...iv.linux.org.uk>,
Dongliang Mu <mudongliangabcd@...il.com>,
Dongliang Mu <dzm91@...t.edu.cn>,
Arve Hjønnevåg <arve@...roid.com>,
Todd Kjos <tkjos@...roid.com>,
Martijn Coenen <maco@...roid.com>,
Joel Fernandes <joel@...lfernandes.org>,
Carlos Llamas <cmllamas@...gle.com>,
Suren Baghdasaryan <surenb@...gle.com>,
Kees Cook <keescook@...omium.org>,
syzkaller <syzkaller@...glegroups.com>,
linux-kernel <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] drivers: binderfs: fix memory leak in binderfs_fill_super
On Mon, Aug 15, 2022 at 10:47:40AM +0200, Christian Brauner wrote:
> On Mon, Aug 15, 2022 at 02:46:36AM +0100, Al Viro wrote:
> > On Fri, Aug 12, 2022 at 04:32:28PM +0200, Greg Kroah-Hartman wrote:
> >
> > > > It's a bit tricky to follow but d_make_root() always consumes the inode.
> > > > On success via d_instantiate() and on failure via iput(). So when
> > > > d_make_root() has been called the inode is off limits. And as soon as
> > > > d_make_root() has returned successfully we're guaranteed that
> > > > sb->s_fs_info is cleaned up if a ->put_super() method has been defined.
> > > > Just fyi.
> > >
> > > Ah, thanks, that wasn't obvious at all.
> > >
> > > greg k-h
> >
> > FWIW, I would rather provide a proper ->kill_sb() and gotten rid of
> > all that stuff. The thing is, unlike ->put_super(), ->kill_sb() is
> > called for *anything* that has gotten to foo_fill_super(). Usually
> > allows to get rid of those "call all of or parts of foo_put_super()
> > on failure exits" and associated bitrot...
> >
> > Like this (completely untested):
> >
> > Signed-off-by: Al Viro <viro@...iv.linux.org.uk>
> > ---
>
> Sounds good,
> Reviewed-by: Christian Brauner (Microsoft) <brauner@...nel.org>
Looks much better to me too. Can someone (Christian?) turn this into a
real patch that I can apply?
thanks,
greg k-h
Powered by blists - more mailing lists