From nobody Sat Feb 7 13:40:47 2026 Received: from mail-oo1-f72.google.com (mail-oo1-f72.google.com [209.85.161.72]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2344126ED37 for ; Tue, 13 Jan 2026 07:59:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.161.72 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768291186; cv=none; b=AfWnhjE/w+dpmGlnAxFXLewLZDk3To85xQLB7q+rTWk4MrtLl502Op75CeneJtbscEKGfdtOX2q0dHy8ZzFu8Jl77KyMco/3+OVW8PWaPcQOWHzl7XRLUdIBA//LDxnyyumAuC5EDBgGkAB3t2MkUBELwudv4Kmx1IdsCnJke9Q= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768291186; c=relaxed/simple; bh=LzquOZQbzkkE7RdQ647QhY6e/8gdaJOu9AGQeW3S+t4=; h=MIME-Version:Date:In-Reply-To:Message-ID:Subject:From:To: Content-Type; b=ENzv8Rc2+TUR/hblPd0F8cNrhnbWYFwC1NVypxHCF5+w+Dbplf77eQpphge8MzkR+ba76prLenWSkS9keNYlQSpiN6vzjkXjRd+Me/M43PkUSclqgzJjKb2TgYP1WAAe/hhPtawPYxvdsIDoQc6FqIgbszKU8Al1sR8Qgg8IDvY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=syzkaller.appspotmail.com; spf=pass smtp.mailfrom=M3KW2WVRGUFZ5GODRSRYTGD7.apphosting.bounces.google.com; arc=none smtp.client-ip=209.85.161.72 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=syzkaller.appspotmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=M3KW2WVRGUFZ5GODRSRYTGD7.apphosting.bounces.google.com Received: by mail-oo1-f72.google.com with SMTP id 006d021491bc7-65f6e15ad5bso10509554eaf.1 for ; Mon, 12 Jan 2026 23:59:44 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1768291184; x=1768895984; h=to:from:subject:message-id:in-reply-to:date:mime-version :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=7MvzNmBb/awDyEToL68dhY16IYlpdw2alvm3XL0uIxs=; b=c8UQ1UOBdJJjlpKjliu+2C7LpxiwzbdJgn6Fk2gMsg86LHU2d8yZEOp14ZuB0iuNDW PkPuWUyT7+/J9mtJqe4wEr7dtPDq+61yNaafA4N8KmCz49LU/3yTkVpMsS0WwLgWNNGb SEvgvpQ0+p2gU4fFEH4TXeMEUfZ6zJE9W7kcvISxKgIEzAG2nzjHU9VZZcrhDWiqcoml 3CQrZ2dQwjMVruGv/Hek6TQ6++RH01LOMzhWL2XxojBhPmma+8JKPl0v/ckgyXnX9bzd Q1MMFWX8q0aymXspos0EmzLRPA9fdkWuFfwRbwEEHADbU0n+bkklpRozC6dHR+/FULut WgjA== X-Gm-Message-State: AOJu0Yw39XQ8rJjFmeiJi4T5h5RQks94QbjJ8MkrhemoG7GmJkPJjk8J VHuVq1wxSJsNYpYYOk75ZxDZl6IDbGe0emRnuM0mmUqbDvj43gJFcp7wWW7PIPrIW6SFf674G1M kznSv50PGV9b932FsK38cJjtSKEEvC7eD66blyQv8+jgdQmnjmy3b67ukb94= X-Google-Smtp-Source: AGHT+IFtx1BzLouRJjMqKWrxWdEuDiQgsnT66fZfIu6OfBhgR7X3hT5fU3VuWxVB1hT2EEc56jIUTNDGDWstrxLQX+Kmi6EeNYqK Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Received: by 2002:a05:6820:4983:b0:65d:3c7:b57 with SMTP id 006d021491bc7-65f54ef66c9mr6425257eaf.34.1768291184072; Mon, 12 Jan 2026 23:59:44 -0800 (PST) Date: Mon, 12 Jan 2026 23:59:44 -0800 In-Reply-To: <6965a06e.050a0220.38aacd.0003.GAE@google.com> X-Google-Appengine-App-Id: s~syzkaller X-Google-Appengine-App-Id-Alias: syzkaller Message-ID: <6965fb70.050a0220.38aacd.000a.GAE@google.com> Subject: Forwarded: [PATCH] romfs: check sb_set_blocksize() return value From: syzbot To: linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" For archival purposes, forwarding an incoming command email to linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com. *** Subject: [PATCH] romfs: check sb_set_blocksize() return value Author: kartikey406@gmail.com #syz test: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git= master romfs_fill_super() ignores the return value of sb_set_blocksize(), which can fail if the requested block size is incompatible with the block device's configuration. This can be triggered by setting a loop device's block size larger than PAGE_SIZE using ioctl(LOOP_SET_BLOCK_SIZE, 32768), then mounting a romfs filesystem on that device. When sb_set_blocksize(sb, ROMBSIZE) is called with ROMBSIZE=3D4096 but the device has logical_block_size=3D32768, bdev_validate_blocksize() fails because the requested size is smaller than the device's logical block size. sb_set_blocksize() returns 0 (failure), but romfs ignores this and continues mounting. The superblock's block size remains at the device's logical block size (32768). Later, when sb_bread() attempts I/O with this oversized block size, it triggers a kernel BUG in folio_set_bh(): kernel BUG at fs/buffer.c:1582! BUG_ON(size > PAGE_SIZE); Fix by checking the return value of sb_set_blocksize() and failing the mount with -EINVAL if it returns 0. Reported-by: syzbot+9c4e33e12283d9437c25@syzkaller.appspotmail.com Closes: https://syzkaller.appspot.com/bug?extid=3D9c4e33e12283d9437c25 Signed-off-by: Deepanshu Kartikey --- fs/romfs/super.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/fs/romfs/super.c b/fs/romfs/super.c index 360b00854115..ac55193bf398 100644 --- a/fs/romfs/super.c +++ b/fs/romfs/super.c @@ -458,7 +458,10 @@ static int romfs_fill_super(struct super_block *sb, st= ruct fs_context *fc) =20 #ifdef CONFIG_BLOCK if (!sb->s_mtd) { - sb_set_blocksize(sb, ROMBSIZE); + if (!sb_set_blocksize(sb, ROMBSIZE)) { + errorf(fc, "romfs: unable to set blocksize\n"); + return -EINVAL; + } } else { sb->s_blocksize =3D ROMBSIZE; sb->s_blocksize_bits =3D blksize_bits(ROMBSIZE); --=20 2.43.0