From nobody Sat Feb 7 18:16:03 2026 Received: from mail-oi1-f200.google.com (mail-oi1-f200.google.com [209.85.167.200]) (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 3D13279CD for ; Sun, 4 Jan 2026 01:15:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.200 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767489352; cv=none; b=BCZ/QvvrEaMitewEKhfPPL4NUNVa+wkFdWhnM8VNxqY+dGaotyiwA266qKFiaXBoA1bOn+vbAbJPQfh4UsxUhNFDzeVbJWnApXfyfD+/fjeexoo5i2Fci+Ist6DgrDKK+JRCuqT2B+rx6f8e9F1aLdzGX9lisGth5nlCwfUVeU8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767489352; c=relaxed/simple; bh=vcOEIYcdOlGbhdnImgmswQB1BWxZFWko3GosmSXmdPY=; h=MIME-Version:Date:In-Reply-To:Message-ID:Subject:From:To: Content-Type; b=kFvtUtIdFr30UNt4LNxMSr9dwHstqgDNj69tG9vkDlm6ymDtQVdUkPNnE25Uw6ApfOoifp0S+P7AWir5JSLWzrHdJ5IOmFNN+M0TkH4MlJeM8R6PlG5w8JgRyjzLX//cVRVa8n7RjdMPVLP/Ow5V9FaasnxEysX7uroS4kjgLX0= 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.167.200 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-oi1-f200.google.com with SMTP id 5614622812f47-450adce3ee8so30039077b6e.1 for ; Sat, 03 Jan 2026 17:15:50 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1767489350; x=1768094150; 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=ZZYNAq203sgt2K1A67OFnKXQhg+t17YF9FiFQKXBsiU=; b=RL6MkVcsB8cYzfvcYi3oIluapkOK59RAwBukxpXwsmrZM1M4GnAml0ayczS4ssNNy2 4+Bp9M+6YcyiH0GMv887/17qmePCbw8cDrw2diHLnsL3L6TrZ+/aPGEAzRBnDY3VqaXm jRZxqUO/yEhGHZ452DxDdmRiEvpSNDPtK5eYUBistfrpZOVrQq9CrRHuLc8KlhKF91Uw DRiUfChYJj0Vvd3gbfp6agemRXMM3ZI5h4Jflmw5pauDhnTBggS3SFuxFH8VKP/S25X8 k9qpCsH7SnaoA6/vBZeaVdtKRc1shd36YKN9kxMMUZ/6INZUDDbMJCf67V0XOGNi7uu/ 7sxQ== X-Gm-Message-State: AOJu0Yy/38GFrN0ryk6ebp94o6F7KIfdHPrXCt/P7F40IMBIQYzmabHr ViudvSGYjCb3PtcufOym6WIVU4mR0OKkvvj7J+lm9VaUKe6TwXY6sLfn1OHUrUJk2kewVAGWdNP 1amAO2/OlZoJBPTUVv31+0xUe/mtvAfQsBMmWmdM7U9WdKoNkwQjLsp7t/OM= X-Google-Smtp-Source: AGHT+IGwLIn0SW4ItOg1iU1OvwfMi8xS8a0LoyS3o1NNvjnjZzyU8YcncCIHiCi9uc5kfYAq7sx4fW9kD3nzbmVWeQzQsuDek3g5 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Received: by 2002:a4a:a50f:0:b0:659:9a49:8fe4 with SMTP id 006d021491bc7-65d0e933d50mr14398224eaf.17.1767489350176; Sat, 03 Jan 2026 17:15:50 -0800 (PST) Date: Sat, 03 Jan 2026 17:15:50 -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: <6959bf46.050a0220.1c9965.0017.GAE@google.com> Subject: Forwarded: [PATCH] ocfs2: validate allocator type to prevent BUG_ON in ocfs2_block_group_search 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 allocator type to prevent BUG_ON in ocfs2_= block_group_search Author: kartikey406@gmail.com #syz test: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git= master A corrupted filesystem image can have an inode allocator with the OCFS2_BITMAP_FL flag incorrectly set, making ocfs2_is_cluster_bitmap() return true. When the code later calls ocfs2_block_group_search(), it triggers BUG_ON(ocfs2_is_cluster_bitmap(inode)) 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_reserve_suballoc_bits() to check that the allocator inode type matches the expected type: - Global bitmap allocator must have OCFS2_BITMAP_FL flag set - Other allocators (inode, extent) must NOT have OCFS2_BITMAP_FL set This follows the existing pattern of validating OCFS2_CHAIN_FL in the same function and uses ocfs2_error() for graceful error handling. Reported-by: syzbot+44c564a3cb08605f34a1@syzkaller.appspotmail.com Closes: https://syzkaller.appspot.com/bug?extid=3D44c564a3cb08605f34a1 Signed-off-by: Deepanshu Kartikey --- fs/ocfs2/suballoc.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/fs/ocfs2/suballoc.c b/fs/ocfs2/suballoc.c index 8e6e5235b30c..fb72c062a8d5 100644 --- a/fs/ocfs2/suballoc.c +++ b/fs/ocfs2/suballoc.c @@ -813,6 +813,26 @@ static int ocfs2_reserve_suballoc_bits(struct ocfs2_su= per *osb, goto bail; } =20 + /* + * Validate allocator type matches expected bitmap type. + * Global bitmap must have BITMAP flag, other allocators must not. + * This prevents a corrupted filesystem from triggering BUG_ON + * in ocfs2_block_group_search() or ocfs2_cluster_group_search(). + */ + if (type =3D=3D GLOBAL_BITMAP_SYSTEM_INODE) { + if (!ocfs2_is_cluster_bitmap(alloc_inode)) { + status =3D ocfs2_error(alloc_inode->i_sb, + "Global bitmap %llu missing bitmap flag\n", + (unsigned long long)le64_to_cpu(fe->i_blkno)); + goto bail; + } + } else if (ocfs2_is_cluster_bitmap(alloc_inode)) { + status =3D ocfs2_error(alloc_inode->i_sb, + "Allocator %llu has invalid bitmap flag\n", + (unsigned long long)le64_to_cpu(fe->i_blkno)); + goto bail; + } + free_bits =3D le32_to_cpu(fe->id1.bitmap1.i_total) - le32_to_cpu(fe->id1.bitmap1.i_used); =20 --=20 2.43.0