From nobody Sat Feb 7 20:47:41 2026 Received: from mail-pf1-f172.google.com (mail-pf1-f172.google.com [209.85.210.172]) (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 DE38D1E7C03 for ; Tue, 2 Dec 2025 11:01:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764673314; cv=none; b=A3Gv+FDYsA0fHW+Pnya/QEZfmjbs7WTzoB5wyIaW/PYczZrtSkvBopoMiNnlvv8xVd9bioz136hTzt7uDIpt7ZpyqP+2Adx9c+KYx0ABQhAd/F0SQuiG/sK3/ee0ny/yR8IRZP4dIFJfxC8QSYnkzS/V2bJqYi8L6+AmuTWQMDE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764673314; c=relaxed/simple; bh=KSK/DnFTxMt4CXWdw7WpUlm58huTuochBw+YyHG7Xws=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=YipRIcLdTcZ4l6pQFXEq4ePjVw6QQdfce/YZpuxb/LreWICOz1UhvSiAn3KiGfsXEiiH3j8FcjuSRFJCSeRTHIptZUAxy/Q/lulgfyp1Kx1HfaALnM95/7Y0TDchlLL3G4HJ2LYQtHUENdXBCHT2vnMR7EqzbXNFVpYYQGahzPU= 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=aGl16e0X; arc=none smtp.client-ip=209.85.210.172 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="aGl16e0X" Received: by mail-pf1-f172.google.com with SMTP id d2e1a72fcca58-7aab7623f42so5766278b3a.2 for ; Tue, 02 Dec 2025 03:01:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1764673312; x=1765278112; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=MsASYmb2vMOkKd3Wj83tvfKA8A5xOvIsAFN5KI+UOYc=; b=aGl16e0Xuf1yhoGq5cyU1FagQ2v1LAVwqR2C5ItqO0ZYD/G+1tkaQ8SGmag6L0Z3ST tK9dY1D7uqXsB2eYS1LqvUHlL40Nu01hmW2KNVTt/SWsmHD3M3KJG/Rux9x8s1tgF03Y DX4IIj8eznhOVWb9gSwvvyBns96uBPaGaHVpWB90G8XcciH1elAT9Y2w2rt+82JE0XQT bZfUsFbqCsNW8f8GuQCr2Wr5rVe9rswJKnjoH+BZo0Ix3zs0EEdCrlHfuUalj3300o2v d8eGQjbmrVLdzpTCOIbxkc+utACVifTILtjyiTeAOWsshSheRMq5nuQy5bY84BADYI93 vSew== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1764673312; x=1765278112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=MsASYmb2vMOkKd3Wj83tvfKA8A5xOvIsAFN5KI+UOYc=; b=jrclub3cvnP6vlH+xbIgSV8zVcaLEe3cf774zsuzCbla/2mWf4OrskH8CQPBGoCwFb BKVzGtAeFAv9hJlFezMMzzc+XHDYy0QL9731jRKThyZVBaRizb4I2Wgo+DPCBQpSfbrw FWmsKQcTAQcKVThlzxHqJ8l/6gV8y7F5Q+QwTwYoxRaeoOtfuX53jLCN5y791fu3s/qD iP7EIYC51gauIWb2mxlYczMBP7M21oYFqVPwViiOoUAY0GTVRBg+pVyMyd4DDBfF7Gta E7dv5xx+kZ6hiYqhY1V/6hzwNOeWKzokBZGWeYr8PSb0IYYsLUih75OkitbfhVtEfrnK 4sQA== X-Forwarded-Encrypted: i=1; AJvYcCXf8ji0sNef5k+ThdLaCoUy652xtBPy9rarif2yNyM+73LlgiYkBIgc5Zc6+UI1iaJLZpwjgEmu+0nVHZI=@vger.kernel.org X-Gm-Message-State: AOJu0YxaPs+yMhu4IJuIp5OW8WaoOIJigytgl6jnYQtmodc5nRrGjmg9 3wEwvjNEP2GkUWu+nLXLFH+wKJfqjd7zVoOgIgyu5YN9qypKUjOFLI0Z X-Gm-Gg: ASbGnctaZ+JsKMltG+759WqDvX43kiPwNDyp4CXGDeWKfeluLmy9LFAreBDc/s2R2gt MKFySZxT5WxEQiXglqoMZ48xv7XE2sg5DwmMq66aiWPXy4RHVvccMHG43NeKeO7dMuqS7+9OSFK GmK2DoKSmx2Xc1i9Ng1SNHTLgsKEDgAdsJsTdHipvhK6pHb4VOAjUr8apx5iZtrBJAk42cTV2U6 Y1efIfuHqOKyuSrfgFOZviItjUKC2EmemCzMaC+IhUKe3ALOvlrHQMRzyVKgHyYPZPzpn0TmnhH vjXs/ZAjH/w5Tq8FtcedPcCwr1pfEJcJyC4HAEnyCkS410l2mEjL5QIX/+kO5QhdZ7qbLJpIJFK tjKc8T2miTtt/NTpNwqYOF2i7Q7cdpmIDXmQLJJ55sG6LqGhc32PV6JH8QeX84CZKB66JzWVmi+ AiIQ== X-Google-Smtp-Source: AGHT+IHxC0PR1yfM2U9StSl5GJj6C8ZHWSYzDiwXzJXB71gZqdXQeyWIDgccVHU5QnCjsqnZx7vtxQ== X-Received: by 2002:a17:90b:2ccc:b0:340:299f:130d with SMTP id 98e67ed59e1d1-34733e60971mr39946087a91.13.1764673312120; Tue, 02 Dec 2025 03:01:52 -0800 (PST) Received: from OSVS.. ([183.101.168.247]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-3477b74b8f1sm16239372a91.14.2025.12.02.03.01.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Dec 2025 03:01:51 -0800 (PST) From: Jaehun Gou To: almaz.alexandrovich@paragon-software.com Cc: ntfs3@lists.linux.dev, linux-kernel@vger.kernel.org, Jaehun Gou , Seunghun Han , Jihoon Kwon Subject: [PATCH] fs: ntfs3: fix infinite loop triggered by zero-sized ATTR_LIST Date: Tue, 2 Dec 2025 20:01:46 +0900 Message-ID: <20251202110146.1886202-1-p22gone@gmail.com> X-Mailer: git-send-email 2.43.0 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" We found an infinite loop bug in the ntfs3 file system that can lead to a Denial-of-Service (DoS) condition. A malformed NTFS image can cause an infinite loop when an ATTR_LIST attribu= te indicates a zero data size while the driver allocates memory for it. When ntfs_load_attr_list() processes a resident ATTR_LIST with data_size set to zero, it still allocates memory because of al_aligned(0). This creates an inconsistent state where ni->attr_list.size is zero, but ni->attr_list.le is non-null. This causes ni_enum_attr_ex to incorrectly assume that no attribu= te list exists and enumerates only the primary MFT record. When it finds ATTR_LIST, the code reloads it and restarts the enumeration, repeating indefinitely. The mount operation never completes, hanging the kernel threa= d. This patch adds validation to ensure that data_size is non-zero before memo= ry allocation. When a zero-sized ATTR_LIST is detected, the function returns -EINVAL, preventing a DoS vulnerability. Co-developed-by: Seunghun Han Signed-off-by: Seunghun Han Co-developed-by: Jihoon Kwon Signed-off-by: Jihoon Kwon Signed-off-by: Jaehun Gou --- fs/ntfs3/attrlist.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/fs/ntfs3/attrlist.c b/fs/ntfs3/attrlist.c index a4d74bed74fa..098bd7e8c3d6 100644 --- a/fs/ntfs3/attrlist.c +++ b/fs/ntfs3/attrlist.c @@ -52,6 +52,11 @@ int ntfs_load_attr_list(struct ntfs_inode *ni, struct AT= TRIB *attr) =20 if (!attr->non_res) { lsize =3D le32_to_cpu(attr->res.data_size); + if (!lsize) { + err =3D -EINVAL; + goto out; + } + /* attr is resident: lsize < record_size (1K or 4K) */ le =3D kvmalloc(al_aligned(lsize), GFP_KERNEL); if (!le) { @@ -66,6 +71,10 @@ int ntfs_load_attr_list(struct ntfs_inode *ni, struct AT= TRIB *attr) u16 run_off =3D le16_to_cpu(attr->nres.run_off); =20 lsize =3D le64_to_cpu(attr->nres.data_size); + if (!lsize) { + err =3D -EINVAL; + goto out; + } =20 run_init(&ni->attr_list.run); =20 --=20 2.43.0