[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YIt9IFY4Xsf5K+eZ@mit.edu>
Date: Thu, 29 Apr 2021 23:44:32 -0400
From: "Theodore Ts'o" <tytso@....edu>
To: Pavel Skripkin <paskripkin@...il.com>
Cc: Vegard Nossum <vegard.nossum@...cle.com>,
akpm@...ux-foundation.org, peterz@...radead.org, axboe@...nel.dk,
pmladek@...e.com, adilger.kernel@...ger.ca,
linux-ext4@...r.kernel.org, linux-kernel@...r.kernel.org,
syzbot+d9e482e303930fa4f6ff@...kaller.appspotmail.com
Subject: Re: [PATCH] ext4: fix memory leak in ext4_fill_super
On Fri, Apr 30, 2021 at 01:05:47AM +0300, Pavel Skripkin wrote:
> > out of the thread function. That means hanging struct mmpd_data off
> > the struct ext4_sb_info structure, and then adding a function like
> > this to fs/ext4/mmp.c
> >
> > static void ext4_stop_mmpd(struct ext4_sb_info *sbi)
That should "extern void ...", since it will be called from
fs/ext4/super.c. I had originally was thinking to put this function
in fs/ext4/super.c, but from the perspective of keeping the MMP code
in the same source file, it probably makes sense to keep this function
with the other MMP functions.
> > {
> > if (sbi->s_mmp_tsk) {
> > kthread_stop(sbi->s_mmp_tsk);
> > brelse(sbi->s_mmp_data->bh);
> > kfree(sbi->s_mmp_data);
> > sbi->s_mmp_data = NULL;
> > sbi->s_mmp_tsk = NULL;
> > }
> > }
> >
> > Basically, just move all of the cleanup so it is done after the
> > kthread is stopped, so we don't have to do any fancy error checking.
> > We just do it unconditionally.
Cheers,
- Ted
Powered by blists - more mailing lists