From nobody Sat Feb 7 20:44:04 2026 Received: from mail-oo1-f70.google.com (mail-oo1-f70.google.com [209.85.161.70]) (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 104B9145B27 for ; Sat, 24 Jan 2026 02:40:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.161.70 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769222402; cv=none; b=mnDOOlg4CZR4dCQpyTagYt0GuF9vZbde4nS5oh5wVLJzYK+qTjaGFXjkDr0+yZCahN6kb0r3NjMBqEK0oyJBEB0PZKsMV9EUi/jyt/aAnSWCJB8ivBoPfeq+/rpx0aMGaLHxt7GpFVjFmTeZqJZYzJNj03tz6oNUThL70fBwaXA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769222402; c=relaxed/simple; bh=LjokdImQhpwOWwLbBpaRC7EOKOQdvSLRUFEmqNrTjIM=; h=MIME-Version:Date:In-Reply-To:Message-ID:Subject:From:To: Content-Type; b=fJSmAZN9egFNpv0dDH/kNXIpJEXQoBjz+TiGy+P/7f+ZmvyH43wJL2cXbnSpYWZYvRl9d6tLiSd7pEBW74W53QFzQDFIaSMbHXkhuMFVSlsHsuYZ1btHgYCA80d2NPjsjx4FdNAzIHjkABPB2Vr4vcjItvDbTIsMLZd0gGSjvUo= 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.70 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-f70.google.com with SMTP id 006d021491bc7-662c9283404so6081245eaf.0 for ; Fri, 23 Jan 2026 18:40:00 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1769222400; x=1769827200; 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=dTJgdjFRILSlI72aFyry9kKJrEQ7hmUiFUSv5Czuum+J0L3Y/Qj2IlVQGSnad3o67l sYi4IYasqg5Jgyh6B36WLU+k/LsZ0NY3UdxcqWOG6QkVjLTR2scM5rMNBBY8wd/pgeFF M4/vVF8EKcmuRLZ5UU5QC3IpVSowA65/V22czqy4nejhs8G3AWoeH3TR564vdZIkYnjz I4W48t0axtGurs/73GxPoDFijkRd0CT5LppIzFOdV+itkA7Y8TFehcvmQf8pIU7Lf3lf qjsiCCDq0Z2vIPQuShzVEO0gx8Bv7nFItJeGG+BgfZ17JH8eWJLg0HZl9qLtjfEzovvW lgvQ== X-Gm-Message-State: AOJu0YxH76hYqr7ROGDESd9EwQJNNaFXTJHIiyxDEc5V93KjloVPWdj8 /P8Bojwiiurezo+ZeK98PqnNCBrYJ6L1p57eqWBWjzRyF+LUa6pNgjOXPvcfSAHgGbbxqogQU6B BJbfme1Pf+QNVI0TcUtg4o0QSL9hxBi6nyUdhPDgw+BItPvg7wDCyGUzJ04o= 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:612:b0:661:522:1036 with SMTP id 006d021491bc7-662c1bf100cmr4308768eaf.19.1769222400006; Fri, 23 Jan 2026 18:40:00 -0800 (PST) Date: Fri, 23 Jan 2026 18:39:59 -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: <697430ff.050a0220.1a75db.0329.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