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: 0a8ac0c1fa ("ntfs: update directory operations")
Signed-off-by: Hyunchul Lee <hyc.lee@gmail.com>
Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
This commit is contained in:
Hyunchul Lee 2026-09-28 16:24:51 +09:00 committed by Namjae Jeon
parent 109c9b0f67
commit 22002cb8b6

View File

@ -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;