Skip to content

Commit 9d63509

Browse files
Paulo AlcantaraSteve French
authored andcommitted
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>
1 parent ef22bb8 commit 9d63509

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

fs/smb/client/inode.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -865,6 +865,8 @@ static void cifs_open_info_to_fattr(struct cifs_fattr *fattr,
865865

866866
out_reparse:
867867
if (S_ISLNK(fattr->cf_mode)) {
868+
if (likely(data->symlink_target))
869+
fattr->cf_eof = strnlen(data->symlink_target, PATH_MAX);
868870
fattr->cf_symlink_target = data->symlink_target;
869871
data->symlink_target = NULL;
870872
}

0 commit comments

Comments
 (0)