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

Gao Xiang gaoxiang25 at huawei.com
Tue Nov 19 23:53:31 AEDT 2019


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

Thanks,
Gao Xiang



More information about the Linux-erofs mailing list