diff options
author | Paulo Alcantara <pc@manguebit.com> | 2023-11-28 22:37:19 +0300 |
---|---|---|
committer | Steve French <stfrench@microsoft.com> | 2023-11-29 05:41:41 +0300 |
commit | 9d63509547a940225d06d7eba1dc412befae255d (patch) | |
tree | 07b7d7c224d96af4269692fa434882f76fc7502d /fs/smb | |
parent | ef22bb800d967616c7638d204bc1b425beac7f5f (diff) | |
download | linux-9d63509547a940225d06d7eba1dc412befae255d.tar.xz |
smb: client: report correct st_size for SMB and NFS symlinks
We can't rely on FILE_STANDARD_INFORMATION::EndOfFile for reparse
points as they will be always zero. Set it to symlink target's length
as specified by POSIX.
This will make stat() family of syscalls return the correct st_size
for such files.
Cc: stable@vger.kernel.org
Signed-off-by: Paulo Alcantara (SUSE) <pc@manguebit.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
Diffstat (limited to 'fs/smb')
-rw-r--r-- | fs/smb/client/inode.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/fs/smb/client/inode.c b/fs/smb/client/inode.c index 42ef8ca446d0..09c5c0f5c96e 100644 --- a/fs/smb/client/inode.c +++ b/fs/smb/client/inode.c @@ -865,6 +865,8 @@ static void cifs_open_info_to_fattr(struct cifs_fattr *fattr, out_reparse: if (S_ISLNK(fattr->cf_mode)) { + if (likely(data->symlink_target)) + fattr->cf_eof = strnlen(data->symlink_target, PATH_MAX); fattr->cf_symlink_target = data->symlink_target; data->symlink_target = NULL; } |