diff options
author | Steve French <smfrench@us.ibm.com> | 2013-09-28 19:24:12 -0400 |
---|---|---|
committer | Steve French <smfrench@gmail.com> | 2013-10-05 22:54:18 -0400 |
commit | c31f330719b7331b2112a5525fe5941a99ac223d (patch) | |
tree | 14e6f0534e820bc30f4fb7e2e876daf072edb0de /fs/cifs/cifspdu.h | |
parent | e62063d69911886a5a92c719d262a2a87e1e5b60 (diff) |
do not treat non-symlink reparse points as valid symlinks
Windows 8 and later can create NFS symlinks (within reparse points)
which we were assuming were normal NTFS symlinks and thus reporting
corrupt paths for. Add check for reparse points to make sure that
they really are normal symlinks before we try to parse the pathname.
We also should not be parsing other types of reparse points (DFS
junctions etc) as if they were a symlink so return EOPNOTSUPP
on those. Also fix endian errors (we were not parsing symlink
lengths as little endian).
This fixes commit d244bf2dfbebfded05f494ffd53659fa7b1e32c1
which implemented follow link for non-Unix CIFS mounts
CC: Stable <stable@kernel.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Signed-off-by: Steve French <smfrench@gmail.com>
Diffstat (limited to 'fs/cifs/cifspdu.h')
-rw-r--r-- | fs/cifs/cifspdu.h | 31 |
1 files changed, 23 insertions, 8 deletions
diff --git a/fs/cifs/cifspdu.h b/fs/cifs/cifspdu.h index a630475e421c..08f9dfb1a894 100644 --- a/fs/cifs/cifspdu.h +++ b/fs/cifs/cifspdu.h | |||
@@ -1491,15 +1491,30 @@ struct file_notify_information { | |||
1491 | __u8 FileName[0]; | 1491 | __u8 FileName[0]; |
1492 | } __attribute__((packed)); | 1492 | } __attribute__((packed)); |
1493 | 1493 | ||
1494 | struct reparse_data { | 1494 | /* For IO_REPARSE_TAG_SYMLINK */ |
1495 | __u32 ReparseTag; | 1495 | struct reparse_symlink_data { |
1496 | __u16 ReparseDataLength; | 1496 | __le32 ReparseTag; |
1497 | __le16 ReparseDataLength; | ||
1497 | __u16 Reserved; | 1498 | __u16 Reserved; |
1498 | __u16 SubstituteNameOffset; | 1499 | __le16 SubstituteNameOffset; |
1499 | __u16 SubstituteNameLength; | 1500 | __le16 SubstituteNameLength; |
1500 | __u16 PrintNameOffset; | 1501 | __le16 PrintNameOffset; |
1501 | __u16 PrintNameLength; | 1502 | __le16 PrintNameLength; |
1502 | __u32 Flags; | 1503 | __le32 Flags; |
1504 | char PathBuffer[0]; | ||
1505 | } __attribute__((packed)); | ||
1506 | |||
1507 | /* For IO_REPARSE_TAG_NFS */ | ||
1508 | #define NFS_SPECFILE_LNK 0x00000000014B4E4C | ||
1509 | #define NFS_SPECFILE_CHR 0x0000000000524843 | ||
1510 | #define NFS_SPECFILE_BLK 0x00000000004B4C42 | ||
1511 | #define NFS_SPECFILE_FIFO 0x000000004F464946 | ||
1512 | #define NFS_SPECFILE_SOCK 0x000000004B434F53 | ||
1513 | struct reparse_posix_data { | ||
1514 | __le32 ReparseTag; | ||
1515 | __le16 ReparseDataLength; | ||
1516 | __u16 Reserved; | ||
1517 | __le64 InodeType; /* LNK, FIFO, CHR etc. */ | ||
1503 | char PathBuffer[0]; | 1518 | char PathBuffer[0]; |
1504 | } __attribute__((packed)); | 1519 | } __attribute__((packed)); |
1505 | 1520 | ||