From nobody Sat Feb 7 11:31:08 2026 Received: from mail-oo1-f71.google.com (mail-oo1-f71.google.com [209.85.161.71]) (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 B9203257824 for ; Sat, 24 Jan 2026 04:14:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.161.71 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769228074; cv=none; b=Qqo6Vmrfjm+b86XfSr6Abyp9TlYnNiMnJWmxD2PJmpJWX45/7RuSRHYyS9xjHG7SdxPZJS4PPOXToHsrSdheaPq7q7mvrSB3cu/USgF2JRiYL82u3irAkMlf5/nsZhjpuLWyOahH4APxUUUI8APMbC9QzNpGSiE9iuDsNKoi5yw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769228074; c=relaxed/simple; bh=LjokdImQhpwOWwLbBpaRC7EOKOQdvSLRUFEmqNrTjIM=; h=MIME-Version:Date:In-Reply-To:Message-ID:Subject:From:To: Content-Type; b=rG9e1AlIKK/FFePzFGDy/hJCa0paQNdlv8soufLYJDHnhAKLSTRZRc6SpQ7V8IJNp94mdQc7q0hUChROpduhD7jo36PGhnIVCoyCTxa1D4JVoGkl8U/IFBt7+5CT4/d2g4eWW3A4+OO0pn1nyHrT5P4ks2gfW/jIJ86P1oQELRg= 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.71 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-f71.google.com with SMTP id 006d021491bc7-661125c8491so4790463eaf.3 for ; Fri, 23 Jan 2026 20:14:32 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1769228071; x=1769832871; 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=mgJqx8m/3ITmNd23GspMhhUBcahHSqvRhf7zNJH4Cck=; b=XIwY3OWhgeSZ8c8tUaUQmSrEJMEVLFK6QQm++0y6pIg86u4JCOgC+b60FUdizJUy1R GJss3zffYR1eZBR190CbIRxjH9ehbCjq6siQ5NrmikZ0UnIN/XNrUpGuhbK4CXBmPv4f 2Anhs75MtHpqRRq7SbDeOn9aFlo1xyVhIIcmRMN49+Rsc2qyA241ryM8RJjjx0w6IJFU z53D+chNDyFJ00aCwdEbdtCg+hJxQR3FMPC/GGmk9dNQa1lNrSqmKALevTN9F412FFEy Kks20TFTJM/Fz4cZwgpO2hUNELD70wBZ8IOdg+vIA+jDcs5H3CMG8/Lvx7mCkoyLUH9T LEVQ== X-Gm-Message-State: AOJu0Ywhr/ivsZ1EmezxZYEYRNLG1dqbt8emHiTgGkL7kf3Mi38zMGSR iaf55MRQKo9DzSjGCUPbIxDeXEugH3ei1pPIbXUL845JFeSFGT1CG9crVV71QTuczyR0YPi+PZG aOx2VveyQBLUzeiN9pxcLItRxDatpDrXIAOc1ZmJoCaMW8MImMxGHQitSx+8= 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:188e:b0:662:c09a:903a with SMTP id 006d021491bc7-662cabd914dmr2549566eaf.78.1769228071753; Fri, 23 Jan 2026 20:14:31 -0800 (PST) Date: Fri, 23 Jan 2026 20:14:31 -0800 In-Reply-To: <69599ddf.050a0220.1c9965.0014.GAE@google.com> X-Google-Appengine-App-Id: s~syzkaller X-Google-Appengine-App-Id-Alias: syzkaller Message-ID: <69744727.050a0220.1d05e9.0000.GAE@google.com> Subject: Forwarded: [PATCH] ocfs2: validate i_blkno and BITMAP_FL consistency in ocfs2_validate_inode_block 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] ocfs2: validate i_blkno and BITMAP_FL consistency in ocfs2= _validate_inode_block Author: kartikey406@gmail.com #syz test: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git= master ocfs2_is_cluster_bitmap() checks whether an inode is the global bitmap by comparing ip_blkno with osb->bitmap_blkno. A corrupted filesystem can have an inode with i_blkno and OCFS2_BITMAP_FL flag inconsistent: - i_blkno matches bitmap_blkno but BITMAP_FL is not set, or - BITMAP_FL is set but i_blkno does not match bitmap_blkno In either case, ocfs2_is_cluster_bitmap() returns incorrect results, triggering BUG_ON in ocfs2_block_group_search() or ocfs2_cluster_group_search() causing a kernel panic. Call trace: ocfs2_block_group_search+0x1c7/0x2c0 fs/ocfs2/suballoc.c:1611 ocfs2_search_chain+0x38a/0x1010 fs/ocfs2/suballoc.c:1764 ocfs2_claim_suballoc_bits+0x3a4/0x650 fs/ocfs2/suballoc.c:1978 ocfs2_claim_new_inode+0x95/0x130 fs/ocfs2/suballoc.c:2137 ocfs2_mknod_locked+0x129/0x510 fs/ocfs2/namei.c:568 ocfs2_mknod+0x5c7/0x11d0 fs/ocfs2/namei.c:802 ocfs2_create+0x136/0x170 fs/ocfs2/namei.c:852 Add validation in ocfs2_validate_inode_block() to check that i_blkno and OCFS2_BITMAP_FL are consistent: - If i_blkno matches bitmap_blkno, BITMAP_FL must be set - If BITMAP_FL is set, i_blkno must match bitmap_blkno This catches corrupted inodes early when reading from disk. Reported-by: syzbot+44c564a3cb08605f34a1@syzkaller.appspotmail.com Closes: https://syzkaller.appspot.com/bug?extid=3D44c564a3cb08605f34a1 Tested-by: syzbot+44c564a3cb08605f34a1@syzkaller.appspotmail.com Signed-off-by: Deepanshu Kartikey --- v3: - Move validation to ocfs2_validate_inode_block() to catch corruption early when inode is read from disk (Joseph Qi) - Add check for both directions of inconsistency v2: - Fix commit message - ocfs2_is_cluster_bitmap() checks ip_blkno against bitmap_blkno, not a flag (Joseph Qi) --- fs/ocfs2/inode.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/fs/ocfs2/inode.c b/fs/ocfs2/inode.c index b5fcc2725a29..2d80934d14b4 100644 --- a/fs/ocfs2/inode.c +++ b/fs/ocfs2/inode.c @@ -1529,6 +1529,27 @@ int ocfs2_validate_inode_block(struct super_block *s= b, } } =20 + /* + * Validate bitmap flag consistency with bitmap_blkno. + * A corrupted inode with mismatched i_blkno and BITMAP_FL would + * cause ocfs2_is_cluster_bitmap() to return incorrect results, + * triggering BUG_ON in ocfs2_block_group_search() or + * ocfs2_cluster_group_search(). + */ + if (le64_to_cpu(di->i_blkno) =3D=3D OCFS2_SB(sb)->bitmap_blkno && + !(di->i_flags & cpu_to_le32(OCFS2_BITMAP_FL))) { + rc =3D ocfs2_error(sb, + "Invalid dinode #%llu: i_blkno matches bitmap but BITMAP flag not set= \n", + (unsigned long long)bh->b_blocknr); + goto bail; + } else if (di->i_flags & cpu_to_le32(OCFS2_BITMAP_FL) && + le64_to_cpu(di->i_blkno) !=3D OCFS2_SB(sb)->bitmap_blkno) { + rc =3D ocfs2_error(sb, + "Invalid dinode #%llu: BITMAP flag set but i_blkno does not match bit= map\n", + (unsigned long long)bh->b_blocknr); + goto bail; + } + rc =3D 0; =20 bail: --=20 2.43.0