lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20260116172113.22143-1-jiashengjiangcool@gmail.com>
Date: Fri, 16 Jan 2026 17:21:13 +0000
From: Jiasheng Jiang <jiashengjiangcool@...il.com>
To: Mark Fasheh <mark@...heh.com>,
	Joel Becker <jlbec@...lplan.org>,
	Joseph Qi <joseph.qi@...ux.alibaba.com>,
	linux-kernel@...r.kernel.org
Cc: ocfs2-devel@...ts.linux.dev,
	Jiasheng Jiang <jiashengjiangcool@...il.com>
Subject: [PATCH] ocfs2: fix slab-out-of-bounds in ocfs2_rotate_requires_path_adjustment

In ocfs2_rotate_requires_path_adjustment(), the variable 'next_free' is
assigned the value of 'left_el->l_next_free_rec'. This value is then used
to index the 'l_recs' array as 'next_free - 1'.

If the filesystem is corrupted or in an unexpected state such that
'l_next_free_rec' is 0, this leads to an array index of -1, triggering
a slab-out-of-bounds access.

Other functions in alloc.c, such as ocfs2_rotate_leaf() and
ocfs2_update_edge_lengths(), effectively guard against this condition.
This patch adds a similar check to return 0 immediately if 'next_free'
is 0, preventing the out-of-bounds access.

Signed-off-by: Jiasheng Jiang <jiashengjiangcool@...il.com>
---
 fs/ocfs2/alloc.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/fs/ocfs2/alloc.c b/fs/ocfs2/alloc.c
index 58bf58b68955..b15c6f751d99 100644
--- a/fs/ocfs2/alloc.c
+++ b/fs/ocfs2/alloc.c
@@ -2327,6 +2327,10 @@ static int ocfs2_rotate_requires_path_adjustment(struct ocfs2_path *left_path,
 
 	left_el = path_leaf_el(left_path);
 	next_free = le16_to_cpu(left_el->l_next_free_rec);
+
+	if (unlikely(next_free == 0))
+		return 0;
+
 	rec = &left_el->l_recs[next_free - 1];
 
 	if (insert_cpos > le32_to_cpu(rec->e_cpos))
-- 
2.25.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ