Skip to content

Commit 7eacba3

Browse files
Eugene Korenevskysmfrench
authored andcommitted
cifs: alloc_path_with_tree_prefix: do not append sep. if the path is empty
alloc_path_with_tree_prefix() concatenates tree prefix and the path. Windows CIFS client does not add separator after the tree prefix if the path is empty. Let's do the same. This fixes mounting DFS namespaces with names containing non-ASCII symbols. BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=215440 Signed-off-by: Eugene Korenevsky <[email protected]> Signed-off-by: Steve French <[email protected]>
1 parent 74ce613 commit 7eacba3

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

fs/cifs/smb2pdu.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2587,8 +2587,13 @@ alloc_path_with_tree_prefix(__le16 **out_path, int *out_size, int *out_len,
25872587

25882588
cp = load_nls_default();
25892589
cifs_strtoUTF16(*out_path, treename, treename_len, cp);
2590-
UniStrcat(*out_path, sep);
2591-
UniStrcat(*out_path, path);
2590+
2591+
/* Do not append the separator if the path is empty */
2592+
if (path[0] != cpu_to_le16(0x0000)) {
2593+
UniStrcat(*out_path, sep);
2594+
UniStrcat(*out_path, path);
2595+
}
2596+
25922597
unload_nls(cp);
25932598

25942599
return 0;

0 commit comments

Comments
 (0)