Skip to contentSkip to conversation

ntfs: avoid misclassifying directory reparse points

PATCH Applied Hyunchul Lee 2 participants 2 messages Sep 28 – Sep 29 NTFS filesystem

lore
Share & tools
lore

Hyunchul Lee

author maintainer
#0 lore raw

PATCH 1/1 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.

---
 fs/ntfs/dir.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
fs/ntfs/dir.c +3 -3
index c2b48bc696bf..b95173f068cb 100644
@@ -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;
 
Signature · 1 line
2.43.0
maintainer Applied
#1 lore raw
Quoted 8 lines · Hyunchul Lee

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.

Applied it to #ntfs-next.
Thanks!