Patch "fs/ntfs3: Fix directory element type detection" has been added to the 6.5-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    fs/ntfs3: Fix directory element type detection

to the 6.5-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     fs-ntfs3-fix-directory-element-type-detection.patch
and it can be found in the queue-6.5 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit cef686905c1307b6d0193ba2bc11d251e82032eb
Author: Gabriel Marcano <gabemarcano@xxxxxxxxx>
Date:   Tue Sep 12 21:50:32 2023 -0700

    fs/ntfs3: Fix directory element type detection
    
    [ Upstream commit 85a4780dc96ed9dd643bbadf236552b3320fae26 ]
    
    Calling stat() from userspace correctly identified junctions in an NTFS
    partition as symlinks, but using readdir() and iterating through the
    directory containing the same junction did not identify the junction
    as a symlink.
    
    When emitting directory contents, check FILE_ATTRIBUTE_REPARSE_POINT
    attribute to detect junctions and report them as links.
    
    Signed-off-by: Gabriel Marcano <gabemarcano@xxxxxxxxx>
    Signed-off-by: Konstantin Komarov <almaz.alexandrovich@xxxxxxxxxxxxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/fs/ntfs3/dir.c b/fs/ntfs3/dir.c
index 063a6654199bc..ec0566b322d5d 100644
--- a/fs/ntfs3/dir.c
+++ b/fs/ntfs3/dir.c
@@ -309,7 +309,11 @@ static inline int ntfs_filldir(struct ntfs_sb_info *sbi, struct ntfs_inode *ni,
 		return 0;
 	}
 
-	dt_type = (fname->dup.fa & FILE_ATTRIBUTE_DIRECTORY) ? DT_DIR : DT_REG;
+	/* NTFS: symlinks are "dir + reparse" or "file + reparse" */
+	if (fname->dup.fa & FILE_ATTRIBUTE_REPARSE_POINT)
+		dt_type = DT_LNK;
+	else
+		dt_type = (fname->dup.fa & FILE_ATTRIBUTE_DIRECTORY) ? DT_DIR : DT_REG;
 
 	return !dir_emit(ctx, (s8 *)name, name_len, ino, dt_type);
 }



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux