Skip to content

Commit

Permalink
smb: client: report correct st_size for SMB and NFS symlinks
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Paulo Alcantara authored and Steve French committed Nov 29, 2023
1 parent ef22bb8 commit 9d63509
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions fs/smb/client/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit 9d63509

Please sign in to comment.