From nobody Sun Feb 8 00:38:49 2026 Received: from mail-oa1-f41.google.com (mail-oa1-f41.google.com [209.85.160.41]) (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 7F8B11EF0B0 for ; Sun, 18 Jan 2026 19:01:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.41 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768762910; cv=none; b=Egq4vQpcZ9qR19fS8XLU7hZs3tAY0jh3G8cZH4yhO2C3D2TwjSUsCFAfxx6S+nCyJwOV3YgBLhXNyqzJ72hEqsg6diwqPt56+sklzqLYxNCa61V06Ie4uaFaMhLgFgQd6UASGa8Db2xtzZKM4gJnyg+ZOdpqNQNgAAFUj01DaCg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768762910; c=relaxed/simple; bh=nMNE6iEfpLstIa10M3kB5FyebBEQOg86SBYePsQerOs=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=ryJ5Lm1Mgmd6xyptSAjaScUKv4IK1QTQlvJMYk19kl5MEorAmjEOBWBvt0SrjFsgA5r4z97UBrNRG7fZMu3Gc+pG1j5RSrrBGuTmBhG2pnPQebUIQiT6ta3fJjWy+eZMRklnxeVStx52qUytqsrRATTudYoNB6As+ii6ADYM53U= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=P/h2neuv; arc=none smtp.client-ip=209.85.160.41 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="P/h2neuv" Received: by mail-oa1-f41.google.com with SMTP id 586e51a60fabf-4042fe53946so1404392fac.3 for ; Sun, 18 Jan 2026 11:01:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1768762908; x=1769367708; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=hNjMslMWG3mKls0Rz/DOZ4WWtAb1rKfHE/u7ZXd1FlU=; b=P/h2neuv1Bz0cRKC12bIKzQLhdxWjZFdlaR4oGOEqBL9siHjXHNrWAsRxles7S26rI v5r694kAn3BLPTMjgAMEGZYlz3USSfBN+WyQXGI0gxC23yX/Cv4y8IcenIVlc4E7e5iD 7ymYvTHBr/sBsrl9hhwRjU/D49XLLbLJillZaHZ478FUAzRECm+JGod841ne3ibSAi86 E0CXBilcEpJXLRYQ0QlydZyYjlwczCy288v/UVijhLv3TI7OnIkZPy5nfubR9jEhqsRw WKd64BfMV1ofJ8epHAwCIrWXPvl8MNqcq98d8leudomacXkLns2uy1uWa9kX2a0uvy8/ 3a1g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1768762908; x=1769367708; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=hNjMslMWG3mKls0Rz/DOZ4WWtAb1rKfHE/u7ZXd1FlU=; b=pPfXjZLo29ZQtD+f1KJkMbHUlKXZ4YpiUMVc4At43G5wMXL084ULyTTf/cjY2tmmik LzSfHBeIKEnxtkEUi8mSN7LucKpwswxgEgg2ZSc+iHJVsqjuqqp7BwVRJ98MZnUOO00h fpZsfUDavY1obuc1gYJnNOJAhPRpLB4EMV0bkT5KzAzyQGZgyHcmfAv5foLoR65dNSea 9372X5cBO8Sw7fKKFDNhCZggmJk+4FC3tC6OrU8SxGyuslH8ywSptQ6t5IRWEaePVSFg DveCGKZ3T3y2MNeYTZzs1xsSCoWhclURnordkyFkxNl3o92dCme6Ang2cVXA0xCseu2f u2iQ== X-Forwarded-Encrypted: i=1; AJvYcCW8GFeb0CwFlQ5HffcHpxI+XT/wnIhZKY6HCL7nUYOAlGaLC5egEz4rdHCvw+g5qiP3RJWF5/lAcY2LiOA=@vger.kernel.org X-Gm-Message-State: AOJu0YxVBl7we+ZYikqSNM+Efh9mIdaFMd1gyr63vNT+EABdWtbnXR4H 7pL6Gxo8yTaCZBaeWP5VjZn2NiKuW8Xges3IswYgdZUBbaBSR2rdjeuq X-Gm-Gg: AY/fxX5g7zDlhdRL7P8AFDsCBC4CQVPX7T/cAK0S3oR1iBQ18auX23gOxH4xq7pXBb3 pd3/ryHXJzsLf+EhHz6k8LL/jJLMVLmfWw5y/GGLW72y1BD+aINT4o9EH1XwA/1qcsXGc+pSObd X+w5/VVWb4WogdcQ4XmzvvXeg7fYax/eAWASihDbZYvVepGJU6TgPa9WnJW474WxboxatsVt2Nx Gsc18dAu4ubo4et0nSSu6+r7RFoaYWlat9cg55UJHIBXdcPkHgXsbRYsAaS6eAORQURjQqxcbg/ vVUnvQEI6ljw8VLNeusUP+/0ennFmiQ8GrVg+TOCoRzIJ5g85u6qV5X9oPqTlpiA+aZD+VePbSk OHU+gcYAo+1q4sfL/SnzTVW6EqucKfdK/G/mhHT65oEMpND/X3JzQayyFS91eCBMFaD9Wn/OT3Z at9YtVkJpL1+sIEr7vHhR+8eMrkT2PVyTWqw3B2e6nViQ= X-Received: by 2002:a05:6871:3319:b0:2e8:f5d6:2247 with SMTP id 586e51a60fabf-4044cfc720cmr4766960fac.32.1768762908380; Sun, 18 Jan 2026 11:01:48 -0800 (PST) Received: from newman.cs.purdue.edu ([128.10.127.250]) by smtp.gmail.com with ESMTPSA id 586e51a60fabf-4044bd14883sm5530224fac.12.2026.01.18.11.01.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 18 Jan 2026 11:01:47 -0800 (PST) From: Jiasheng Jiang To: markus.elfring@web.de Cc: almaz.alexandrovich@paragon-software.com, jiashengjiangcool@gmail.com, linux-kernel@vger.kernel.org, ntfs3@lists.linux.dev, stable@vger.kernel.org Subject: [PATCH v2] fs/ntfs3: Fix infinite loop in hdr_find_split due to zero-sized entry Date: Sun, 18 Jan 2026 19:01:45 +0000 Message-Id: <20260118190145.41997-1-jiashengjiangcool@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <65bf90b1-8806-4f8c-b7e7-d90193d28e88@web.de> References: <65bf90b1-8806-4f8c-b7e7-d90193d28e88@web.de> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" 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. Fixes: 82cae269cfa9 ("fs/ntfs3: Add initialization of super block") Signed-off-by: Jiasheng Jiang --- Changelog: v1 -> v2: 1. Add a Fixes tag. --- 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 struc= t INDEX_HDR *hdr) return p; =20 esize =3D le16_to_cpu(e->size); + + if (esize < sizeof(struct NTFS_DE)) + return NULL; } =20 return e; --=20 2.25.1