public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: Christian Brauner <brauner@kernel.org>
Cc: "Al Viro" <viro@zeniv.linux.org.uk>,
	"Dongliang Mu" <mudongliangabcd@gmail.com>,
	"Dongliang Mu" <dzm91@hust.edu.cn>,
	"Arve Hjønnevåg" <arve@android.com>,
	"Todd Kjos" <tkjos@android.com>,
	"Martijn Coenen" <maco@android.com>,
	"Joel Fernandes" <joel@joelfernandes.org>,
	"Carlos Llamas" <cmllamas@google.com>,
	"Suren Baghdasaryan" <surenb@google.com>,
	"Kees Cook" <keescook@chromium.org>,
	syzkaller <syzkaller@googlegroups.com>,
	linux-kernel <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] drivers: binderfs: fix memory leak in binderfs_fill_super
Date: Wed, 17 Aug 2022 13:43:07 +0200	[thread overview]
Message-ID: <YvzUS/7bd1mm6c/V@kroah.com> (raw)
In-Reply-To: <20220815084740.2jpqud4htermrdko@wittgenstein>

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@zeniv.linux.org.uk>
> > ---
> 
> Sounds good,
> Reviewed-by: Christian Brauner (Microsoft) <brauner@kernel.org>

Looks much better to me too.  Can someone (Christian?) turn this into a
real patch that I can apply?

thanks,

greg k-h

  reply	other threads:[~2022-08-17 11:43 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-12 13:21 [PATCH] drivers: binderfs: fix memory leak in binderfs_fill_super Dongliang Mu
2022-08-12 13:41 ` Christian Brauner
2022-08-12 13:48   ` Dongliang Mu
2022-08-12 14:18     ` Christian Brauner
2022-08-15  0:59       ` Dongliang Mu
2022-08-12 13:41 ` Greg Kroah-Hartman
2022-08-12 13:56   ` Dongliang Mu
2022-08-12 14:02     ` Dongliang Mu
2022-08-12 14:09     ` Greg Kroah-Hartman
2022-08-12 14:24       ` Christian Brauner
2022-08-12 14:32         ` Greg Kroah-Hartman
2022-08-15  1:46           ` Al Viro
2022-08-15  1:48             ` Al Viro
2022-08-15  8:47             ` Christian Brauner
2022-08-17 11:43               ` Greg Kroah-Hartman [this message]
2022-08-17 13:03                 ` [PATCH] binderfs: rework superblock destruction Christian Brauner
2022-08-17 13:59                   ` Al Viro
2022-08-17 14:01                     ` Christian Brauner
2022-08-17 14:19                       ` Al Viro
2022-08-17 14:32                         ` Al Viro
2022-08-17 15:05                           ` Christian Brauner
2022-08-17 14:51                         ` Christian Brauner
2022-08-17 15:21                           ` Al Viro
2022-08-17 15:24                             ` Christian Brauner

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=YvzUS/7bd1mm6c/V@kroah.com \
    --to=gregkh@linuxfoundation.org \
    --cc=arve@android.com \
    --cc=brauner@kernel.org \
    --cc=cmllamas@google.com \
    --cc=dzm91@hust.edu.cn \
    --cc=joel@joelfernandes.org \
    --cc=keescook@chromium.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maco@android.com \
    --cc=mudongliangabcd@gmail.com \
    --cc=surenb@google.com \
    --cc=syzkaller@googlegroups.com \
    --cc=tkjos@android.com \
    --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