From 22002cb8b6594830dc0b2d26faf1aa5fa3de94c1 Mon Sep 17 00:00:00 2001 From: Hyunchul Lee Date: Mon, 28 Sep 2026 16:24:51 +0900 Subject: [PATCH] ntfs: avoid misclassifying directory reparse points Windows directory symlinks and junctions can carry FILE_ATTR_DUP_FILE_NAME_INDEX_PRESENT in their entry while the reparse flag is stored only in. The old directory enumeration path treated such entries as DT_DIR, allowing no-follow userspace scanners to recurse through symlink targets. Fixes: 0a8ac0c1fa0b ("ntfs: update directory operations") Signed-off-by: Hyunchul Lee Signed-off-by: Namjae Jeon --- fs/ntfs/dir.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/fs/ntfs/dir.c b/fs/ntfs/dir.c index c2b48bc696bf..b95173f068cb 100644 --- a/fs/ntfs/dir.c +++ b/fs/ntfs/dir.c @@ -635,11 +635,11 @@ static inline int ntfs_filldir(struct ntfs_volume *vol, } mref = MREF_LE(ie->data.dir.indexed_file); - if (ie->key.file_name.file_attributes & + if (ie->key.file_name.file_attributes & FILE_ATTR_REPARSE_POINT) + dt_type = ntfs_reparse_tag_dt_types(vol, mref); + else if (ie->key.file_name.file_attributes & FILE_ATTR_DUP_FILE_NAME_INDEX_PRESENT) dt_type = DT_DIR; - else if (ie->key.file_name.file_attributes & FILE_ATTR_REPARSE_POINT) - dt_type = ntfs_reparse_tag_dt_types(vol, mref); else dt_type = DT_REG;