Skip to content

Commit ff8abbd

Browse files
pcacjrSteve French
authored andcommitted
smb: client: fix regression with native SMB symlinks
Some users and customers reported that their backup/copy tools started to fail when the directory being copied contained symlink targets that the client couldn't parse - even when those symlinks weren't followed. Fix this by allowing lstat(2) and readlink(2) to succeed even when the client can't resolve the symlink target, restoring old behavior. Cc: [email protected] Cc: [email protected] Reported-by: Remy Monsen <[email protected]> Closes: https://lore.kernel.org/r/CAN+tdP7y=jqw3pBndZAGjQv0ObFq8Q=+PUDHgB36HdEz9QA6FQ@mail.gmail.com Reported-by: Pierguido Lambri <[email protected]> Fixes: 12b466e ("cifs: Fix creating and resolving absolute NT-style symlinks") Signed-off-by: Paulo Alcantara (Red Hat) <[email protected]> Signed-off-by: Steve French <[email protected]>
1 parent 86731a2 commit ff8abbd

File tree

1 file changed

+4
-16
lines changed

1 file changed

+4
-16
lines changed

fs/smb/client/reparse.c

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -875,15 +875,8 @@ int smb2_parse_native_symlink(char **target, const char *buf, unsigned int len,
875875
abs_path += sizeof("\\DosDevices\\")-1;
876876
else if (strstarts(abs_path, "\\GLOBAL??\\"))
877877
abs_path += sizeof("\\GLOBAL??\\")-1;
878-
else {
879-
/* Unhandled absolute symlink, points outside of DOS/Win32 */
880-
cifs_dbg(VFS,
881-
"absolute symlink '%s' cannot be converted from NT format "
882-
"because points to unknown target\n",
883-
smb_target);
884-
rc = -EIO;
885-
goto out;
886-
}
878+
else
879+
goto out_unhandled_target;
887880

888881
/* Sometimes path separator after \?? is double backslash */
889882
if (abs_path[0] == '\\')
@@ -910,13 +903,7 @@ int smb2_parse_native_symlink(char **target, const char *buf, unsigned int len,
910903
abs_path++;
911904
abs_path[0] = drive_letter;
912905
} else {
913-
/* Unhandled absolute symlink. Report an error. */
914-
cifs_dbg(VFS,
915-
"absolute symlink '%s' cannot be converted from NT format "
916-
"because points to unknown target\n",
917-
smb_target);
918-
rc = -EIO;
919-
goto out;
906+
goto out_unhandled_target;
920907
}
921908

922909
abs_path_len = strlen(abs_path)+1;
@@ -966,6 +953,7 @@ int smb2_parse_native_symlink(char **target, const char *buf, unsigned int len,
966953
* These paths have same format as Linux symlinks, so no
967954
* conversion is needed.
968955
*/
956+
out_unhandled_target:
969957
linux_target = smb_target;
970958
smb_target = NULL;
971959
}

0 commit comments

Comments
 (0)