Re: [PATCH v2] binderfs: rework superblock destruction
From: Christian Brauner
Date: Tue Aug 23 2022 - 09:53:41 EST
On Tue, Aug 23, 2022 at 12:45:26PM +0200, Greg Kroah-Hartman wrote:
> On Tue, Aug 23, 2022 at 11:53:39AM +0200, Christian Brauner wrote:
> > From: Al Viro <viro@xxxxxxxxxxxxxxxxxx>
> >
> > So far we relied on
> > .put_super = binderfs_put_super()
> > to destroy info we stashed in sb->s_fs_info. This gave us the required ordering
> > between ->evict_inode() and sb->s_fs_info destruction.
> >
> > But the current implementation of binderfs_fill_super() has a memory leak in
> > the rare circumstance that d_make_root() fails because ->put_super() is only
> > called when sb->s_root is initialized. Fix this by removing ->put_super() and
> > simply do all that work in binderfs_kill_super().
> >
> > Reported-by: Dongliang Mu <mudongliangabcd@xxxxxxxxx>
> > Signed-off-by: Al Viro <viro@xxxxxxxxxxxxxxxxxx>
> > Signed-off-by: Christian Brauner (Microsoft) <brauner@xxxxxxxxxx>
> > ---
> > drivers/android/binderfs.c | 30 +++++++++++++++++-------------
> > 1 file changed, 17 insertions(+), 13 deletions(-)
>
> What changed from v1?
Ah, forgot to add:
/* v2 */
Christian Brauner (Microsoft) <brauner@xxxxxxxxxx>:
- Call kill_litter_super() before sb->s_fs_info cleanup.