From nobody Wed Feb 11 05:36:47 2026 Received: from mail-qk1-f176.google.com (mail-qk1-f176.google.com [209.85.222.176]) (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 A943F38553D for ; Tue, 10 Feb 2026 15:56:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.222.176 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770739000; cv=none; b=J4vKPtfmJ5cH3+N+577Z7yOx2lRIox/iVsPyZhwRdvDqwSSfBe55fY1c00Zjit3e1+UxRdIQ/6dRdCoUN5wqDpi/4sUcKYjXi0fsKXJtvlgiTOlWzYbAFT3BEtNHMetUR9HCXCQ4VZmMh7mVUhSSsZpEhaEEgwNdJTqlMkt3Tkc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770739000; c=relaxed/simple; bh=b1KI81QCVyZKda481lPa8TvpkjXnj8jSJ7iZxEBkXKw=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=cH5Avsousy8OXHpb8/K9xe4PW24WbTDjvtX6BY09hoJTjPCPiVTC08yPXOtEN2nOxbN79QTjjs1Gi2Gquwklhcgfw2Ik0s/EvXJS9v7v23iZfv2gmBqgwjphqN4wtEsXlQFQoO69u7PEZlvu8Tgyh58iSqj38/perf6nKxP6NXk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=u.northwestern.edu; spf=pass smtp.mailfrom=u.northwestern.edu; dkim=pass (2048-bit key) header.d=u-northwestern-edu.20230601.gappssmtp.com header.i=@u-northwestern-edu.20230601.gappssmtp.com header.b=h6HYtlu3; arc=none smtp.client-ip=209.85.222.176 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=u.northwestern.edu Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=u.northwestern.edu Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=u-northwestern-edu.20230601.gappssmtp.com header.i=@u-northwestern-edu.20230601.gappssmtp.com header.b="h6HYtlu3" Received: by mail-qk1-f176.google.com with SMTP id af79cd13be357-8c5386f1c9fso586590285a.1 for ; Tue, 10 Feb 2026 07:56:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=u-northwestern-edu.20230601.gappssmtp.com; s=20230601; t=1770738997; x=1771343797; 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=aDpGjkoxzYtvXKPUSGDqMhAIzIEx7lz/mHNbFicp3GE=; b=h6HYtlu3f4zGnEmw6aZhsWAvGcE50bBQmvUrYnZuMu4yS1wXUZuj/sdYFqQys+Aqsr Wi3uMtt0LwW1EzxA9gWwnE+cdNmXpm18LbYpF9eSRa/J3WDm3eUG/ovca8H1kfVBxBRW X77FXRzKVqe8hoTSBugEWCFrVyHKtWjom6j4yFGHBxbLjZMyMqePUrtjDjA1FzP9G9d7 dwtEC6SLYD4CnMDgFW8On/usB6OLNAqcuSOe5QSnpTvAyIQCgDygoATRUqcmWhwEHNbE OO0lxDdeTApS4MDMBYDTu2vtK2eB382j+FSiRK4S9EiIe3Aiym3t4a1wqzUwJa2CIe4T YiZA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1770738998; x=1771343798; 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=aDpGjkoxzYtvXKPUSGDqMhAIzIEx7lz/mHNbFicp3GE=; b=cCERc8U+oTYmtqylPSJ+Q8iu8dTMjzOZ50on/JskGqFKlti52AtkGMKaP0NEvza4MA LYO2J+ud2FOjp/wG1iYc62ySxtQJew6BELYekLTmFIvISu0NlKmqKpyKcA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a05:620a:7010:b0:8c6:e1ff:8cfa with SMTP id af79cd13be357-8caf1307e4fmr1949595785a.60.1770738997009; Tue, 10 Feb 2026 07:56:37 -0800 (PST) Received: from security.cs.northwestern.edu (security.cs.northwestern.edu. [165.124.184.136]) by smtp.gmail.com with ESMTPSA id af79cd13be357-8caf77f6f20sm1048773985a.2.2026.02.10.07.56.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Feb 2026 07:56:36 -0800 (PST) From: Ziyi Guo To: Konstantin Komarov Cc: ntfs3@lists.linux.dev, linux-kernel@vger.kernel.org, Ziyi Guo Subject: [PATCH] ntfs3: reject inodes with zero non-DOS link count Date: Tue, 10 Feb 2026 15:56:34 +0000 Message-Id: <20260210155634.380168-1-n7l8m4@u.northwestern.edu> X-Mailer: git-send-email 2.34.1 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" ntfs_read_mft() counts file name attributes into two variables: names (all names including DOS 8.3) and links (non-DOS names only). The validation at line 424 checks names but set_nlink() at line 436 uses links. A corrupted NTFS image where all file name attributes have type FILE_NAME_DOS passes the names check but results in set_nlink(inode, 0). When such an inode is loaded via a code path that passes name=3DNULL to ntfs_iget5() and the nlink=3D0 inode enters the VFS. The subsequent unlink, rmdir, or rename targeting this inode calls drop_nlink() which triggers WARN_ON(inode->i_nlink =3D=3D 0) in fs/inode.c. An all-DOS-name MFT record cannot exist on a valid NTFS volume. Reject such records by checking for links =3D=3D 0 before calling set_nlink(). Signed-off-by: Ziyi Guo --- fs/ntfs3/inode.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/fs/ntfs3/inode.c b/fs/ntfs3/inode.c index 0a9ac5efeb67..a2984a4996c8 100644 --- a/fs/ntfs3/inode.c +++ b/fs/ntfs3/inode.c @@ -433,6 +433,11 @@ static struct inode *ntfs_read_mft(struct inode *inode, ni->mi.dirty =3D true; } =20 + if (!links) { + err =3D -EINVAL; + goto out; + } + set_nlink(inode, links); =20 if (S_ISDIR(mode)) { --=20 2.34.1