[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20260117184859.37979-1-jiashengjiangcool@gmail.com>
Date: Sat, 17 Jan 2026 18:48:59 +0000
From: Jiasheng Jiang <jiashengjiangcool@...il.com>
To: Konstantin Komarov <almaz.alexandrovich@...agon-software.com>,
linux-kernel@...r.kernel.org
Cc: ntfs3@...ts.linux.dev,
Jiasheng Jiang <jiashengjiangcool@...il.com>
Subject: [PATCH] fs/ntfs3: Fix infinite loop in hdr_find_split due to zero-sized entry
The function hdr_find_split iterates over index entries to calculate a
split point. The loop increments the offset 'o' by 'esize', which is
derived directly from the on-disk 'e->size' field.
If a corrupted or malicious filesystem image contains an index entry
with a size of 0, the variable 'o' will fail to advance. This results
in an infinite loop if the condition 'o < used_2' remains true, causing
a kernel hang (Denial of Service).
This patch adds a sanity check to ensure 'esize' is at least the size
of the NTFS_DE structure, consistent with validation logic in sibling
functions like hdr_find_e.
Signed-off-by: Jiasheng Jiang <jiashengjiangcool@...il.com>
---
fs/ntfs3/index.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/fs/ntfs3/index.c b/fs/ntfs3/index.c
index 7157cfd70fdc..da6927e6d360 100644
--- a/fs/ntfs3/index.c
+++ b/fs/ntfs3/index.c
@@ -577,6 +577,9 @@ static const struct NTFS_DE *hdr_find_split(const struct INDEX_HDR *hdr)
return p;
esize = le16_to_cpu(e->size);
+
+ if (esize < sizeof(struct NTFS_DE))
+ return NULL;
}
return e;
--
2.25.1
Powered by blists - more mailing lists