summaryrefslogtreecommitdiffstats
path: root/fs/ksmbd/mgmt/tree_connect.c
diff options
context:
space:
mode:
authorAtte Heikkilä <atteh.mailbox@gmail.com>2022-09-15 15:49:11 +0200
committerSteve French <stfrench@microsoft.com>2022-10-05 08:15:37 +0200
commit16b5f54e30c1ddec36bdf946a299b3254aace477 (patch)
treedf57c1e9c146006b13183ba9e8a117accdfc02c7 /fs/ksmbd/mgmt/tree_connect.c
parentksmbd: port to vfs{g,u}id_t and associated helpers (diff)
downloadlinux-16b5f54e30c1ddec36bdf946a299b3254aace477.tar.xz
linux-16b5f54e30c1ddec36bdf946a299b3254aace477.zip
ksmbd: casefold utf-8 share names and fix ascii lowercase conversion
strtolower() corrupts all UTF-8 share names that have a byte in the C0 (À ISO8859-1) to DE (Þ ISO8859-1) range, since the non-ASCII part of ISO8859-1 is incompatible with UTF-8. Prevent this by checking that a byte is in the ASCII range with isascii(), before the conversion to lowercase with tolower(). Properly handle case-insensitivity of UTF-8 share names by casefolding them, but fallback to ASCII lowercase conversion on failure or if CONFIG_UNICODE is not set. Refactor to move the share name casefolding immediately after the share name extraction. Also, make the associated constness corrections. Signed-off-by: Atte Heikkilä <atteh.mailbox@gmail.com> Acked-by: Namjae Jeon <linkinjeon@kernel.org> Signed-off-by: Steve French <stfrench@microsoft.com>
Diffstat (limited to 'fs/ksmbd/mgmt/tree_connect.c')
-rw-r--r--fs/ksmbd/mgmt/tree_connect.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/ksmbd/mgmt/tree_connect.c b/fs/ksmbd/mgmt/tree_connect.c
index 97ab7987df6e..867c0286b901 100644
--- a/fs/ksmbd/mgmt/tree_connect.c
+++ b/fs/ksmbd/mgmt/tree_connect.c
@@ -17,7 +17,7 @@
struct ksmbd_tree_conn_status
ksmbd_tree_conn_connect(struct ksmbd_conn *conn, struct ksmbd_session *sess,
- char *share_name)
+ const char *share_name)
{
struct ksmbd_tree_conn_status status = {-ENOENT, NULL};
struct ksmbd_tree_connect_response *resp = NULL;