]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
omfs: handle set_blocksize failures
authorChristoph Hellwig <hch@lst.de>
Mon, 11 May 2026 07:16:55 +0000 (09:16 +0200)
committerChristian Brauner <brauner@kernel.org>
Thu, 21 May 2026 11:39:36 +0000 (13:39 +0200)
omfs 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 <hch@lst.de>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Link: https://patch.msgid.link/20260511071701.2456211-11-hch@lst.de
Signed-off-by: Christian Brauner (Amutable) <brauner@kernel.org>
fs/omfs/inode.c

index 834cae1e622331c9bc12ed79a0a979678b848084..1d915ef72119fb86585db8a9c0f257779958f576 100644 (file)
@@ -478,7 +478,8 @@ static int omfs_fill_super(struct super_block *sb, struct fs_context *fc)
        sb->s_time_min = 0;
        sb->s_time_max = U64_MAX / MSEC_PER_SEC;
 
-       sb_set_blocksize(sb, 0x200);
+       if (!sb_set_blocksize(sb, 0x200))
+               goto end;
 
        bh = sb_bread(sb, 0);
        if (!bh)
@@ -530,7 +531,8 @@ static int omfs_fill_super(struct super_block *sb, struct fs_context *fc)
         * Use sys_blocksize as the fs block since it is smaller than a
         * page while the fs blocksize can be larger.
         */
-       sb_set_blocksize(sb, sbi->s_sys_blocksize);
+       if (!sb_set_blocksize(sb, sbi->s_sys_blocksize))
+               goto out_brelse_bh;
 
        /*
         * ...and the difference goes into a shift.  sys_blocksize is always