Re: [PATCH 08/10] minix: handle set_blocksize failures

Jan Kara <[email protected]> Mon, 11 May 2026 18:08:18 +0200
Newsgroups dev.linux.lists.ntfs3,org.kernel.vger.linux-fsdevel
Message-ID <mxb2r7knst7hz2k454w6i7xy62kd6pyj6m2zqsaddkxqpzykxu@zqpqtbnigdp6>
On Mon 11-05-26 09:16:53, Christoph Hellwig wrote:
> minix uses buffer_heads, which don't handle block size > PAGE_SIZE well.
> Without this, mounting we will hit the
> 
>         BUG_ON(offset >= folio_size(folio));
> 
> in folio_set_bh on the first __bread_gfp call.
> 
> Signed-off-by: Christoph Hellwig <[email protected]>
> ---
>  fs/minix/inode.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/fs/minix/inode.c b/fs/minix/inode.c
> index 9c6bac248907..03a69b13950d 100644
> --- a/fs/minix/inode.c
> +++ b/fs/minix/inode.c
> @@ -292,7 +292,8 @@ static int minix_fill_super(struct super_block *s, struct fs_context *fc)
>  		sbi->s_namelen = 60;
>  		sbi->s_version = MINIX_V3;
>  		sbi->s_mount_state = MINIX_VALID_FS;
> -		sb_set_blocksize(s, m3s->s_blocksize);
> +		if (!sb_set_blocksize(s, m3s->s_blocksize))
> +			goto out;

This should go to out_release AFAICT. Otherwise we leak the bh.

								Honza

>  		s->s_max_links = MINIX2_LINK_MAX;
>  	} else
>  		goto out_no_fs;
> -- 
> 2.53.0
> 
-- 
Jan Kara <[email protected]>
SUSE Labs, CR