[PATCH] erofs: add error handling for erofs_fill_super()

Chengguang Xu cgxu519 at mykernel.net
Wed Nov 20 21:08:07 AEDT 2019


 ---- 在 星期二, 2019-11-19 20:51:13 Gao Xiang <gaoxiang25 at huawei.com> 撰写 ----
 > Hi Chengguang,
 > 
 > On Tue, Nov 19, 2019 at 07:37:44PM +0800, Chengguang Xu wrote:
 > > There are some potential resource leaks in error case
 > > of erofs_fill_super(), so add proper error handling
 > > for it.
 > > 
 > > Signed-off-by: Chengguang Xu <cgxu519 at mykernel.net>
 > > ---
 > >  fs/erofs/super.c | 31 +++++++++++++++++++++++--------
 > >  1 file changed, 23 insertions(+), 8 deletions(-)
 > > 
 > > diff --git a/fs/erofs/super.c b/fs/erofs/super.c
 > > index 0e369494f2f2..06e721bd1c8c 100644
 > > --- a/fs/erofs/super.c
 > > +++ b/fs/erofs/super.c
 > > @@ -369,7 +369,7 @@ static int erofs_fill_super(struct super_block *sb, void *data, int silent)
 > >      sb->s_fs_info = sbi;
 > >      err = erofs_read_superblock(sb);
 > >      if (err)
 > > -        return err;
 > > +        goto free;
 > 
 > Could you give some hints what is the potential leak exactly?
 > Actually, it was modified on purpose recently, see the following threads:
 > https://lore.kernel.org/r/20190720224955.GD17978@ZenIV.linux.org.uk
 > and
 > https://lore.kernel.org/r/20190721040547.GF17978@ZenIV.linux.org.uk

Sorry, it seems I misread some part of code, please just drop the patch.

Thanks



More information about the Linux-erofs mailing list