Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 591093264E7; Sat, 17 Oct 2026 17:48:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1792259302; cv=none; b=e8Evr/KkS+O/Z9RxERkdr39gk5nID434oy1fuXVVv7bT21tSV/8IGEQjZAQv/ufCq834gHRtCCgB/nntQgASA0mVRy0mH1tW3CPkh6XB4YQt79yCmBFoKBPjcrwCp1tzz0QwnnMgF3bMp88BZr8Kqkp7uTOiBZRFq4xflht6UNo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1792259302; c=relaxed/simple; bh=BERD4WjLxSeU3lzTKXQoFCcGrJZiR6PIXFuUcKi34NE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=fBYO1/tgy49xeSS30GEcYIX/E9Lb4uzVQoVOYQl+K/HC7UzLHKCr+nK3rrI+aLqMqiERpPbl/G+xa+odVHt7xj017gBEkTFNJPg7TY2d9izwrFqNkDIPbmB7BDMGwIUsI+czs4s3YxOVrQ66jVN6w4oAcZeqIALeacsZkvhV92c= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=pvOpg/Iz; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="pvOpg/Iz" Received: by smtp.kernel.org (Postfix) with ESMTPSA id A9F3D1F000C4; Sat, 17 Oct 2026 17:48:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1792259301; bh=V2lk8Gtc2VbUQTZgFApjPR/pzABFi5O3rNqAtijYvGw=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=pvOpg/Izyo2xVvLqUxRkvT4vpbpiM/+k5S1BEY4w55drCwKZEfJByWuFnH0zoxhla RW5lupPz4NPhmQ4DmV+X2bFhK/qMUehf5vNmXNBJK0FQUDD64ygzYNLRHwpX4meAmt yxqhMsRlycKcpuxsse/Mtc26X6R07pV3mDehKCsQ= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Dmitry Antipov , syzbot+77026564530dbc29b854@syzkaller.appspotmail.com, syzbot+5054473a31f78f735416@syzkaller.appspotmail.com, Joseph Qi , Junxiao Bi , Jun Piao , Deepanshu Kartikey , Heming Zhao , Joel Becker , Mark Fasheh , Andrew Morton , Sasha Levin Subject: [PATCH 6.6 1168/1674] ocfs2: add extra consistency checks for chain allocator dinodes Date: Sat, 17 Oct 2026 17:57:20 +0200 Message-ID: <20261017160501.126381263@linuxfoundation.org> X-Mailer: git-send-email 2.56.0 In-Reply-To: <20261017160431.119607952@linuxfoundation.org> References: <20261017160431.119607952@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.6-stable review patch. If anyone has any objections, please let me know. ------------------ From: Dmitry Antipov [ Upstream commit e1c70505ee8158c1108340d9cd67182ade93af4a ] When validating chain allocator dinode in 'ocfs2_validate_inode_block()', add an extra checks whether a) the maximum amount of chain records in 'struct ocfs2_chain_list' matches the value calculated based on the filesystem block size, and b) the next free slot index is within the valid range. Link: https://lkml.kernel.org/r/20251030153003.1934585-1-dmantipov@yandex.ru Signed-off-by: Dmitry Antipov Reported-by: syzbot+77026564530dbc29b854@syzkaller.appspotmail.com Closes: https://syzkaller.appspot.com/bug?extid=77026564530dbc29b854 Reported-by: syzbot+5054473a31f78f735416@syzkaller.appspotmail.com Closes: https://syzkaller.appspot.com/bug?extid=5054473a31f78f735416 Suggested-by: Joseph Qi Reviewed-by: Joseph Qi Cc: Junxiao Bi Cc: Jun Piao Cc: Deepanshu Kartikey Cc: Heming Zhao Cc: Joel Becker Cc: Mark Fasheh Signed-off-by: Andrew Morton Stable-dep-of: e234973f286e ("ocfs2: validate fast symlink target during inode read") Signed-off-by: Sasha Levin --- fs/ocfs2/inode.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/fs/ocfs2/inode.c b/fs/ocfs2/inode.c index 10cfe0fef98da..34ba82c7a1237 100644 --- a/fs/ocfs2/inode.c +++ b/fs/ocfs2/inode.c @@ -1624,6 +1624,23 @@ int ocfs2_validate_inode_block(struct super_block *sb, } } + if (le32_to_cpu(di->i_flags) & OCFS2_CHAIN_FL) { + struct ocfs2_chain_list *cl = &di->id2.i_chain; + + if (le16_to_cpu(cl->cl_count) != ocfs2_chain_recs_per_inode(sb)) { + rc = ocfs2_error(sb, "Invalid dinode %llu: chain list count %u\n", + (unsigned long long)bh->b_blocknr, + le16_to_cpu(cl->cl_count)); + goto bail; + } + if (le16_to_cpu(cl->cl_next_free_rec) > le16_to_cpu(cl->cl_count)) { + rc = ocfs2_error(sb, "Invalid dinode %llu: chain list index %u\n", + (unsigned long long)bh->b_blocknr, + le16_to_cpu(cl->cl_next_free_rec)); + goto bail; + } + } + rc = 0; bail: -- 2.53.0